SA-MP Forums Archive
Car spawner command problem - 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: Car spawner command problem (/showthread.php?tid=316725)



Car spawner command problem - IvancheBG - 08.02.2012

I have an error in my command!
Here it is:

Код:
if(strcmp(cmd, "/v", true) == 0)
    {
        new Index;
		new tmp2[256]; tmp2 = strtok(cmdtext,Index);
		new tmp3[256]; tmp3 = strtok(cmdtext,Index);
	    if(!strlen(tmp)) return
		SendClientMessage(playerid, COLOR, ""RED"Usage:/car [ModelID/Name] [Colour1] [Colour2]");
		new car;
		new colour1, colour2;
   		if(!IsNumeric(tmp))
	 	car = GetVehicleModelIDFromName(tmp);
  		else car = strval(tmp);
		if(car < 400 || car > 611) return  SendClientMessage(playerid, COLOR, ""RED"ERROR: Invalid Vehicle Model ID!");
		if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
		if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
		new LVehicleID;
		new Float:X,Float:Y,Float:Z;
		new Float:Angle,int1;
		GetPlayerPos(playerid, X,Y,Z);
		GetPlayerFacingAngle(playerid,Angle);
		int1 = GetPlayerInterior(playerid);
		LVehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1);
		LinkVehicleToInterior(LVehicleID,int1);
		return 1;
	}
Erorrs:

Код:
C:\Documents and Settings\user\Desktop\server samp\gamemodes\testserver.pwn(1344) : error 017: undefined symbol "IsNumeric"
C:\Documents and Settings\user\Desktop\server samp\gamemodes\testserver.pwn(1345) : error 017: undefined symbol "GetVehicleModelIDFromName"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: Car spawner command problem - IvancheBG - 08.02.2012

I fixed the vehicle error no just the Is numeric


Re: Car spawner command problem - T0pAz - 08.02.2012

pawn Код:
IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}



Re: Car spawner command problem - IvancheBG - 08.02.2012

Okay no errors but when i tried to spawn a vehicle /car example turismo 1 5(colors) and it says

Usage:/car [ModelID/Name] [Colour1] [Colour2]");


Re: Car spawner command problem - [XST]O_x - 08.02.2012

Change:
pawn Код:
if(!strlen(tmp))
//to
if(!strlen(tmp2))
Should solve your problem.


Re: Car spawner command problem - MP2 - 08.02.2012

Use sscanf, it's MUCH easier.

pawn Код:
if(sscanf(params, "s[64]I(-1)I(-1)", model, c1, c2)) return SendClientMessage(playerid, COLOR, ""RED"Usage:/car [ModelID/Name] [Colour1] [Colour2]");



Re: Car spawner command problem - IvancheBG - 08.02.2012

It isnt wokring.I will write you in ls.