Whats wrong with this ZCMD command? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whats wrong with this ZCMD command? (
/showthread.php?tid=253473)
Whats wrong with this ZCMD command? -
Osviux - 06.05.2011
Код:
CMD:papildyti(playerid, params[])
{
if(cmdtext[10]==0 || !IsNumeric(cmdtext[7]))
{
SendClientMessage(playerid,COLOR,"{FF0000}* Papildyti saskaita: {00FF00}/papildyti [kiek]");
return 1;
}
new kiek = StringToInt(cmdtext[7]);
if(playerDB[playerid][papildymas] < kiek)
{
SendClientMessage(playerid,COLOR,"{00FF00}* Tu tiek neturi!");
return 1;
}
playerDB[playerid][papildymas]-=kiek;
playerDB[playerid][mobsas]+=kiek;
return 1;
}
Код:
C:\Documents and Settings\Labas\Desktop\GM\gamemodes\GM.pwn(3189) : error 017: undefined symbol "cmdtext"
C:\Documents and Settings\Labas\Desktop\GM\gamemodes\GM.pwn(3189) : warning 215: expression has no effect
C:\Documents and Settings\Labas\Desktop\GM\gamemodes\GM.pwn(3189) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Labas\Desktop\GM\gamemodes\GM.pwn(3189) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Labas\Desktop\GM\gamemodes\GM.pwn(3189) : fatal error 107: too many error messages on one line
Re: Whats wrong with this ZCMD command? -
System64 - 06.05.2011
do you use sscanf? Btw. in ZCMD you don't use cmdtext than params!!
Re: Whats wrong with this ZCMD command? -
Mean - 06.05.2011
You could of translate it to english.
Try this:
pawn Код:
CMD:papildyti( playerid, params[ ] )
{
if( !strlen( params ) || !IsNumeric( params ) )
return SendClientMessage( playerid,COLOR,"{FF0000}* Papildyti saskaita: {00FF00}/papildyti [kiek]" );
new kiek = StringToInt( params );
if( playerDB[ playerid ][ papildymas ] < kiek )
return SendClientMessage( playerid,COLOR,"{00FF00}* Tu tiek neturi!" );
playerDB[ playerid ][ papildymas ] -= kiek;
return playerDB[ playerid ][ mobsas ] += kiek;
}