Whats wrong here?
#1

public OnPlayerCommandText(playerid, cmdtext[])
{
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new giveplayerid;

if(strcmp(cmdtext, "/givenrg", true) == 0)

LINE 107 new string[256], tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /give nrg [id]");
giveplayerid = strval(tmp);
{
if(IsPlayerConnected(giveplayerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "%s(%i) Has get the NRG-500 by the admin!", sendername, playerid);
SendClientMessageToAll(giveplayerid, COLOR_RED, string);
new Floatcx, Floatcy, Floatcz;
GetPlayerePos(giveplayerid,scx, scy, scz);
SetVehiclePos(522,scx+1,scy+1,scz+1);
format(string, sizeof(string), "You have gave NRG-500 to a player%s(%i)", giveplayer, giveplayerid);
SendClientMessage(playerid, COLOR_RED, string);
GivePlayerMoney( playerid, 10000 );
}
else
{
format(string, sizeof(string), "SERVER: %d isn't connected", giveplayerid);
SendClientMessage(playerid, COLOR_WHITE, string);
}



return 1;
}
return 0;
}



D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\filterscripts\Givenrg.pwn(107) : error 003: declaration of a local variable must appear in a compound block
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\filterscripts\Givenrg.pwn(107) : warning 217: loose indentation
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\filterscripts\Givenrg.pwn(107) : error 017: undefined symbol "string"
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\filterscripts\Givenrg.pwn(107) : warning 215: expression has no effect
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\filterscripts\Givenrg.pwn(107) : error 001: expected token: ";", but found "]"
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\filterscripts\Givenrg.pwn(107) : fatal error 107: too many error messages on one line
Reply
#2

You forgot an opening bracket "{" after the stcmp function.
Reply
#3

oh ok
Reply
#4

D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\filterscripts\Givenrg.pwn(10 : error 017: undefined symbol "strtok"
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\filterscripts\Givenrg.pwn(10 : error 033: array must be indexed (variable "tmp")



line after line 107
Reply
#5

Put this somewhere in your code outside of any other functions/callbacks.

pawn Код:
stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply
#6

D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\filterscripts\Givenrg.pwn(164) : error 017: undefined symbol "idx"


Line after 108
Reply
#7

pawn Код:
new idx;
Reply
#8

new Float, Float:y, Float:z;
GetPlayerPos(giveplayerid,x, y, z);
CreateVehicle(522,x,y,z); Doesnt match a definition


Reply
#9

Now the problem is because i cant /givenrg ID
Reply
#10

new Float, Float:y, Float:z;
GetPlayerPos(giveplayerid,x, y, z);
CreateVehicle(522,x,y,z);
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)