[HELP] /car
#1

CMD:car(playerid,params[]) {
if ( pInfo[playerid][Adminlevel] < 0)
if(IsPlayerInVehicle(playerid, 32))return SendClientMessage(playerid,0x33CCFFAA,"{FF0000}[sD]:{808080}Вие не трябва да сте в автомобил!");
new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
if(!strlen(tmp)) return SendClientMessage(playerid, 0x33CCFFAA, "{808080}/car [Modelid/Name] [colour1] [colour2]");
if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,0x33CCFFAA,"{FF0000}[sD]:{808080}Ти вече си в превозно средсво");
new car, colour1, colour2, string[128];
if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp);
if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
if(PlayerInfo[playerid][pCar] != -1 && !IsPlayerAdmin(playerid) ) CarDeleter(PlayerInfo[playerid][pCar]);
new LVehicleID,Float:X,Float:Y,Float:Z, Float:Angle,int1; GetPlayerPos(playerid, X,Y,Z); GetPlayerFacingAngle(playerid,Angle); DestroyVehicle( LVehicleID ); int1 = GetPlayerInterior(playerid)estroyVehicle( LVehicleID );
LVehicleID = CreateVehicle(car, X+3,Y,Z+3, Angle, colour1, colour2, -1); SetVehicleNumberPlate(LVehicleID, "{FF0000}[sD]"); LinkVehicleToInterior(LVehicleID,int1);GetPlayerIn terior(playerid);
PutPlayerInVehicle(playerid, LVehicleID, 0);
new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, true, true, alarm, doors, bonnet, boot, objective);
SetVehicleNumberPlate(vehicleid, "ABCD 123");
PlayerInfo[playerid][pCar] = LVehicleID;
format(string, sizeof(string), "%s spawned a \"%s\" (Model:%d) colour (%d, %d), at %0.2f, %0.2f, %0.2f", pName(playerid), VehicleNames[car-400], car, colour1, colour2, X, Y, Z);
format(string, sizeof(string), "{FF0000}[CAR]:{808080}Вие взехте \"%s\" (Ид:%d) Цвят (%d, %d)", VehicleNames[car-400], car, colour1, colour2);
return SendClientMessage(playerid,lightblue, string);
} else return SendClientMessage(playerid,0x33CCFFAA,"ERROR: You need to be level 3 to use this command");
}



520: new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);


(520) : error 017: undefined symbol "strtok"
(520) : error 033: array must be indexed (variable "tmp2")
(520) : error 017: undefined symbol "strtok"
(520) : fatal error 107: too many error messages on one line
Reply
#2

Add This Somewhere:
pawn Код:
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
#3

no working

(524) : error 017: undefined symbol "IsNumeric"
(527) : error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo"
(527) : warning 215: expression has no effect
(527) : error 001: expected token: ";", but found "]"
(527) : error 029: invalid expression, assumed zero
(527) : fatal error 107: too many error messages on one line

(524) if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp);
(527) if(PlayerInfo[playerid][pCar] != -1 && !IsPlayerAdmin(playerid) ) CarDeleter(PlayerInfo[playerid][pCar]);
Reply
#4

O.o I think you missed an include, add the include gl_common
Reply
#5

(525) : error 017: undefined symbol "IsNumeric"
(52 : error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo"
(52 : warning 215: expression has no effect
(52 : error 001: expected token: ";", but found "]"
(52 : error 029: invalid expression, assumed zero
(52 : fatal error 107: too many error messages on one line

(525) if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp);
(52 if(PlayerInfo[playerid][pCar] != -1 && !IsPlayerAdmin(playerid) ) CarDeleter(PlayerInfo[playerid][pCar]);
Reply
#6

add this :
Quote:

stock IsNumeric(string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)