Car spawner command problem
#1

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.
Reply
#2

I fixed the vehicle error no just the Is numeric
Reply
#3

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;
}
Reply
#4

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]");
Reply
#5

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

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]");
Reply
#7

It isnt wokring.I will write you in ls.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)