PDA

View Full Version : Script help!


kingcrome
31/10/2013, 10:56 PM
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

Mattakil
31/10/2013, 11:03 PM
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
}

DarkLored
31/10/2013, 11:05 PM
He will have errors with loose intedition
here is the right one

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

kingcrome
31/10/2013, 11:06 PM
Thanks!

Mattakil
31/10/2013, 11:13 PM
He will have errors with loose intedition
here is the right one

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