SA-MP Forums Archive
How to create more commands in one fs - 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: How to create more commands in one fs (/showthread.php?tid=286527)



How to create more commands in one fs - wumpyc - 29.09.2011

Hey guys do you know how can i make more commands in one filterscript without errors...im doing the buyparrot and sellparrot command...and i get like invalid function or declaration for other command,,1. one without errors
help pls


Re: How to create more commands in one fs - wumpyc - 29.09.2011

i dont mean hundred but dont you think that it would be useful to have buyparrot and sellparrot in same fs?


Re: How to create more commands in one fs - wumpyc - 29.09.2011

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/buyparrot", cmdtext, true, 10) == 0)
{
if GetPlayerMoney(playerid) >=20000*then
SendClientMessage(playerid, 0xFF0000FF,"You dont have enough money!");
else
GivePlayerMoney(playerid,-20000);
SetPlayerAttachedObject(playerid,1,19078,1,0.32072 2,-0.067912,-0.165151,0.000000,0.000000,0.000000,1.000000,1.000 000,1.000000);
}
return 1;
}
if (strcmp("/sellparrot", cmdtext, true, 10) == 0)
{
GivePlayerMoney(playerid,20000);
return 1;
}


ERRORS:
C:\Documents and Settings\scry\Desktop\Truck srv\filterscripts\parrot.pwn(46) : error 010: invalid function or declaration
C:\Documents and Settings\scry\Desktop\Truck srv\filterscripts\parrot.pwn(49) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.


Re: How to create more commands in one fs - wumpyc - 29.09.2011

wut should i have to change?


Re: How to create more commands in one fs - aRoach - 29.09.2011

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/buyparrot", cmdtext, true, 10) == 0)
    {
        if(GetPlayerMoney(playerid) >=20000) return SendClientMessage(playerid, 0xFF0000FF,"You dont have enough money!");

        GivePlayerMoney(playerid,-20000);
        SetPlayerAttachedObject(playerid,1,19078,1,0.32072 2,-0.067912,-0.165151,0.000000,0.000000,0.000000,1.000000,1.000 000,1.000000);
        return 1;
    }
    if (!strcmp(cmdtext, "/sellparrot"))
    {
        GivePlayerMoney(playerid,20000);
        return 1;
    }
    return 1;
}
Look and compare( learn )...


Re: How to create more commands in one fs - wumpyc - 29.09.2011

Quote:
Originally Posted by aRoach
View Post
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/buyparrot", cmdtext, true, 10) == 0)
    {
        if(GetPlayerMoney(playerid) >=20000) return SendClientMessage(playerid, 0xFF0000FF,"You dont have enough money!");

        GivePlayerMoney(playerid,-20000);
        SetPlayerAttachedObject(playerid,1,19078,1,0.32072 2,-0.067912,-0.165151,0.000000,0.000000,0.000000,1.000000,1.000 000,1.000000);
        return 1;
    }
    if (strcmp("/sellparrot", cmdtext, true, 10) == 0)
    {
        GivePlayerMoney(playerid,20000);
        return 1;
    }
    return 1;
}
Look and compare( learn )...
thanks dude


Re: How to create more commands in one fs - [Diablo] - 29.09.2011

found another error.
pawn Code:
if(GetPlayerMoney(playerid) >=20000) return SendClientMessage(playerid, 0xFF0000FF,"You dont have enough money!");
i think this should be
pawn Code:
if(GetPlayerMoney(playerid) < 20000)



Re: How to create more commands in one fs - Vince - 29.09.2011

This is actually proper Pawn code:
pawn Code:
if GetPlayerMoney(playerid) < 20000 *then return SendClientMessage(playerid, 0xFF0000FF,"You dont have enough money!");
Not very useful unless you explicitly want to get rid of the round brackets.