http://sampforum.hu/index.php?topic=3100.0A másik meg
public OnPlayerCommandText(playerid, cmdtext[]) {
new string[256];
new playermoney;
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new cmd[256];
new giveplayerid, moneys, idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, \"/utal\", true) == 0) {
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_YELLOW, \"HASZNÁLAT: /utal [id] [összeg]\");
return 1;
}
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_YELLOW, \"HASZNÁLAT: /utal [id] [összeg]\");
return 1;
}
moneys = strval(tmp);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys) {
GivePlayerMoney(playerid, (0 - moneys));
GivePlayerMoney(giveplayerid, moneys);
format(string, sizeof(string), \"Küldtél %s(player: %d)-nak/nek $%d-t.\", giveplayer,giveplayerid, moneys);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), \"Kaptál $%d-t %s(player: %d)-tól/tõl.\", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
printf(\"%s(playerid:%d) has transfered %d to %s(playerid:%d)\",sendername, playerid, moneys, giveplayer, giveplayerid);
} else
{
SendClientMessage(playerid, COLOR_YELLOW, \"Elõször pénzed legyen.\");
}
} else {
format(string, sizeof(string), \"%d nem jáccik!\", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
return 0;
}
Meg kell hozzá strtok.