san andreas multiplayer (gta) uses pawn programming language. i'm owner of server on sa-mp , i'm not pro i'd if possible. basically, have command checks player's statistics when he/she online, i'd have command check them when they're offline. that's code of commmand checks player's statistics when he's online.
cmd:check(playerid, var[]) { new user; if(!logged(playerid)) return nologin(playerid); if(player[playerid][padmin] >= 2 || player[playerid][pstaffobserver]) { if(sscanf(var,"us[32]", user, var)) { sendclientmessage(playerid, color_white, "{00bfff}usage:{ffffff} /check [playerid] [checks]"); sendclientmessage(playerid, color_grad2, "** [checks]: stats"); return 1; } if(!strcmp(var, "stats", true)) { if(!logged(user)) return nologinb(playerid); showstats(playerid, user); } } else { noauth(playerid); } return 1; }
i use zcmd command processor , dini saving system. i'd make cmd:ocheck display stock showstats , it'll work /ocheck [firstname_lastname].
any help? please if possible.
thanks
~kevin
for command require, you'll have load data player's userfile.
you'll begin
if(!logged(playerid)) return nologin(playerid); if(player[playerid][padmin] >= 2 || player[playerid][pstaffobserver]) {
to check if player using authorized use command. following this,
if(str, "s[32]", name))
you cannot use 'u' formatter here, because you're checking offline player's statistics. after this, need check if user registered if isn't, return error user of command if is, check if online already. if online, return error admin use command instead of 'ocheck' if he's offline, can safely proceed load statistics (you can use code used loading data when player logs in, except time should printed
for eg,
format(str, sizeof(str), "score: %s, money: %d", dini_int(file, "score"), dini_int(file, "score") );
Comments
Post a Comment