08.09.2012, 22:13
Try these out, if there is an error tell me. You should try using sscanf and zcmd to make it easier.
Код:
if(strcmp(cmd, "/givekill", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givekill [kills]"); return 1; } new kills1; tmp = strtok(cmdtext, idx); kills1 = strval(tmp); if (PlayerInfo[playerid][pAdmin] == 1337) { for(new i = 0; i <MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(i != INVALID_PLAYER_ID) { PlayerInfo[i][pKills] += kills1; SetPlayerScore(i, PlayerInfo[playa][pKills]); } } } } } return 1; }
Код:
if(strcmp(cmd, "/givemoney", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givemoney [money]"); return 1; } new money; tmp = strtok(cmdtext, idx); money = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 1337) { for(new i = 0; i <MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(i != INVALID_PLAYER_ID) { GivePlayerCash(i, money); } } } } } return 1; }