Car system help
#1

Error:
PHP код:
C:\Users\Kevin11\Desktop\Napoli\gamemodes\rp.pwn(1156) : error 017undefined symbol "CMD" 
Script with first error:
PHP код:
CMD:spawnauto(playeridparams[])
{
    new 
Float:vxFloat:vyFloat:vzvid;
    
tmp strtok(CMDidx);
    if (!
strlen(tmp)) return SendClientMessage(playerid0xF69521AA"Utilizza: /spawnauto [vehicleid/nome]");
    if (
IsNumeric(tmp) == 1)
    {
       
vid strval(tmp);
    } else {
      
vid GetVehicleIDFromName(tmp);
    }
    if ((
vid 400) || (vid 611) || (vid == 590) || (vid == 569) || (vid == 570) || (vid == 537) || (vid == 538) || (vid == 449))
    {
       return 
SendClientMessage(playerid0xF69521AA"Veicolo non riconosciuto.");
    }
    else
    {
       
GetPlayerPos(playeridvxvyvz);
       
CreateVehicle(vidvx random(9) - 4vy random(9) - 4vz0, -1, -1, -1);
       new 
car GetPlayerVehicleID(playerid);
       
format(stringa,sizeof(stringa),"{0xF69521AA}T{0xF69521AA}D{0xFFFF00AA} %d",random(999));
       
SetVehicleNumberPlate(carstringa);
       
SendClientMessage(playerid0xFFFF00AA"Auto Spawnata con successo");
       return 
1;
}
}
return 
0;


PHP код:
 C:\Users\Kevin11\Desktop\Napoli\gamemodes\rp.pwn(3269) : error 021symbol already defined"strtok" 
PHP код:
 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;

guys help me pls
Reply
#2

Can u show me line 1156?
Reply
#3

Are you sure that you have included zcmd?
Also, remove that custom strtok function.

Edit: Did you put the code under OnPlayerCommandText ?
Reply
#4

PHP код:
tmp strtok(CMDidx); 
Reply
#5

Try this:
PHP код:
public OnPlayerCommandText(playeridcmdtext[])

   new 
indexcmd[20];
   
cmd strtok(cmdtextindex);
    if (
strcmp(cmd"/spawnauto"true) == 0)
    {
    new 
Float:vxFloat:vyFloat:vzvid
    
tmp strtok(cmdtextindex); 
    if (!
strlen(tmp)) return SendClientMessage(playerid0xF69521AA"Utilizza: /spawnauto [vehicleid/nome]"); 
    if (
IsNumeric(tmp) == 1
    { 
       
vid strval(tmp); 
    } else { 
      
vid GetVehicleIDFromName(tmp); 
    } 
    if ((
vid 400) || (vid 611) || (vid == 590) || (vid == 569) || (vid == 570) || (vid == 537) || (vid == 538) || (vid == 449)) 
    { 
       return 
SendClientMessage(playerid0xF69521AA"Veicolo non riconosciuto."); 
    } 
    else 
    { 
       
GetPlayerPos(playeridvxvyvz); 
       
CreateVehicle(vidvx random(9) - 4vy random(9) - 4vz0, -1, -1, -1); 
       new 
car GetPlayerVehicleID(playerid); 
       
format(stringa,sizeof(stringa),"{0xF69521AA}T{0xF69521AA}D{0xFFFF00AA} %d",random(999)); 
       
SetVehicleNumberPlate(carstringa); 
       
SendClientMessage(playerid0xFFFF00AA"Auto Spawnata con successo"); 
       return 
1

}
return 
0;

Reply
#6

I have zcmd.
Reply
#7

Use sscanf instead of strtok. strtok is outdated.
Link to sscanf: https://sampforum.blast.hk/showthread.php?tid=570927
Reply
#8

Ok, i have only this error
PHP код:
 error 021symbol already defined"strtok" 
Reply
#9

Just replace CMD with params. And for the second error, just remove the function. The error literally tells you what the problem is.
Reply
#10

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
And for the second error, just remove the function. The error literally tells you what the problem is.
Come on.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)