SendClientMessage - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SendClientMessage (
/showthread.php?tid=438490)
SendClientMessage -
whando - 20.05.2013
Hello.. I got a command /setmoney, it sets the player money, but I can't get it working that it send me a message 'You have set ***'s money to *** and the person which I setted the money gets a message Admin *** has set your money to ***.
This is my code:
Код:
if(strcmp(cmd, "/setmoney", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setmoney [playerid/PartOfName] [amount]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setmoney [playerid/PartOfName] [amount]");
return 1;
}
money = strvalEx(tmp);
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
ResetPlayerMoney(playa);
PlayerInfo[playa][pCash] = money;
GivePlayerMoney(playa, money);
format(string, sizeof(string), "You have setted %s's money to $%d.",PlayerName(giveplayerid), money);
SendClientMessage(giveplayerid, COLOR_BLUE, string);
format(string, sizeof(string), "Admin %s Has set your money to $%d.", PlayerName(playerid), money);
SendClientMessage(playerid, COLOR_BLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}
How do I fix it lol.
Re: SendClientMessage -
BenTaylorUK - 20.05.2013
Switch giveplayerid and playerid in the strings.
Re: SendClientMessage -
whando - 20.05.2013
Still not working, only get a message; Admin (nothing) has set your money to ****
Edit; Deleted my 2 NPC busdrivers, looks like it is working now!
Nope.. It's still not working, I got the 2 messages now, but one of them has to go to the reciever.. Not me.. How do I fix that?