SA-MP Forums Archive
Need help with spawn vehicle 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)
+--- Thread: Need help with spawn vehicle command! (/showthread.php?tid=643324)



Need help with spawn vehicle command! - Maky184 - 17.10.2017

Script:

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/car", cmdtext, true, 10) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
new Float:posx, Float:posy, Float:posz;
GetPlayerPos(playerid, posx, posy, posz);
CreateVehicle(strval(tmp), posx, posy, posz, 0, random(126), random(126), 600);
return 1;
}
return 0;
}

Error:

....pwn(90) : error 017: undefined symbol "idx"


Re: Need help with spawn vehicle command! - StrikerZ - 17.10.2017

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/car"cmdtexttrue10) == 0)
    {
        new 
tmp[128], idx;
        
tmp strtok(cmdtextidx);
        new 
Float:posxFloat:posyFloat:posz;
        
GetPlayerPos(playeridposxposyposz);
        
CreateVehicle(strval(tmp), posxposyposz0random(126), random(126), 600);
        return 
1;
    }
    return 
0;




Re: Need help with spawn vehicle command! - Escobabe - 17.10.2017

Maybe it's your style of scripting or something, but it's better if you switch to ZCMD.