Script help! - 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: Script help! (
/showthread.php?tid=473003)
Script help! -
kingcrome - 31.10.2013
When i add a command like this
Код:
if (strcmp("/9mm", cmdtext, true, 10) == 0)
{
if(GetPlayerMoney(playerid) < 7000) return SendClientMessage(playerid, 0xAA3333AA, "You do not have enough money");
GivePlayerWeapon(playerid, 22, 102);
GivePlayerMoney(playerid, -7000 );
SendClientMessage(playerid, 0xAA3333AA, "You have been given a 9mm");
It complies fine but when i go in game it does at is should but then it says unknown command
Re: Script help! -
Mattakil - 31.10.2013
pawn Код:
if (strcmp("/9mm", cmdtext, true, 10) == 0)
{
if(GetPlayerMoney(playerid) < 7000) return SendClientMessage(playerid, 0xAA3333AA, "You do not have enough money");
GivePlayerWeapon(playerid, 22, 102);
GivePlayerMoney(playerid, -7000 );
SendClientMessage(playerid, 0xAA3333AA, "You have been given a 9mm");
return 1;//forgetting this will cause unknown command
}
Re: Script help! -
DarkLored - 31.10.2013
He will have errors with loose intedition
here is the right one
pawn Код:
if (strcmp("/9mm", cmdtext, true, 10) == 0)
{
if(GetPlayerMoney(playerid) < 7000) return SendClientMessage(playerid, 0xAA3333AA, "You do not have enough money");
GivePlayerWeapon(playerid, 22, 102);
GivePlayerMoney(playerid, -7000 );
SendClientMessage(playerid, 0xAA3333AA, "You have been given a 9mm");
return 1;//forgetting this will cause unknown command
}
[EDIT] I just edited Mattakill's post
Re: Script help! -
kingcrome - 31.10.2013
Thanks!
Re: Script help! -
Mattakil - 31.10.2013
Quote:
Originally Posted by DarkLored
He will have errors with loose intedition
here is the right one
pawn Код:
if (strcmp("/9mm", cmdtext, true, 10) == 0) { if(GetPlayerMoney(playerid) < 7000) return SendClientMessage(playerid, 0xAA3333AA, "You do not have enough money"); GivePlayerWeapon(playerid, 22, 102); GivePlayerMoney(playerid, -7000 ); SendClientMessage(playerid, 0xAA3333AA, "You have been given a 9mm"); return 1;//forgetting this will cause unknown command }
[EDIT] I just edited Mattakill's post
|
Actually, it wont give errors, I think it looks neater to do it that way, and always have...I never got a warning :P