/car command not working
#1

Well I am trying to transfer a /car command from SeifAdmin to my script, because I need it for something on the script to work.... here is the command

pawn Код:
CMD:car(playerid, params[])
{
    if(DMZone[playerid] == 0)
    {
        new string[256];
        new car = GetVehicleModelIDFromName(tmp);
        if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "USAGE: /car [vehicleid|name] [color1] [color2]"), true;
        new color1 = strval(tmp);
        new color2 = strval(tmp);

        new Float:X,Float:Y,Float:Z,Float:A;
        GetPlayerPos(playerid, X,Y,Z);
        GetPlayerFacingAngle(playerid, A);
        X += (5 * floatsin(-A, degrees));
        Y += (5 * floatcos(-A, degrees));
        new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 600000000);
        format(string, sizeof(string), "Vehicle %s(%d) spawned.", VehNames[GetVehicleModel(carid)-400], carid);
        SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    if(DMZone[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"ERROR: You are in a DM Zone");
    return 1;
}
Remember this is transfered from Seif Admin to here. I get these 3 errors

Код:
\gamemodes\FD.pwn(3100) : error 017: undefined symbol "tmp"
\gamemodes\FD.pwn(3103) : error 017: undefined symbol "tmp"
\gamemodes\FD.pwn(3104) : error 017: undefined symbol "tmp"
Can someone please help me
Reply
#2

pawn Код:
CMD:car(playerid, params[])
{
    if(DMZone[playerid] == 0)
    {
        new string[256];
        new car = GetVehicleModelIDFromName(vehname[]);
        new color1;
        new color2;
        if(!sscanf(params, "iii",car,  color1, color2); return SendClientMessage(playerid, COLOR_GREY, "USAGE: /car [vehicleid|name] [color1] [color2]"), true;

        new Float:X,Float:Y,Float:Z,Float:A;
        GetPlayerPos(playerid, X,Y,Z);
        GetPlayerFacingAngle(playerid, A);
        X += (5 * floatsin(-A, degrees));
        Y += (5 * floatcos(-A, degrees));
        new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 600000000);
        format(string, sizeof(string), "Vehicle %s(%d) spawned.", VehNames[GetVehicleModel(carid)-400], carid);
        SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    if(DMZone[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"ERROR: You are in a DM Zone");
    return 1;
}
try this
Reply
#3

Undefined symbol vehname[]
Reply
#4

try to find: "public OnPlayerCommandText" on your mod, and put: "new tmp[128];" under it

like:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new tmp[128];
and replace the script with that:

pawn Код:
CMD:car(playerid, params[])
{
    if(DMZone[playerid] == 0)
    {
        new string[256];
        tmp = strtok(cmdtext, idx);
        new car = GetVehicleModelIDFromName(tmp);
        if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, "USAGE: /car [vehicleid|name] [color1] [color2]"), true;
        new color1 = strval(tmp);
        new color2 = strval(tmp);

        new Float:X,Float:Y,Float:Z,Float:A;
        GetPlayerPos(playerid, X,Y,Z);
        GetPlayerFacingAngle(playerid, A);
        X += (5 * floatsin(-A, degrees));
        Y += (5 * floatcos(-A, degrees));
        new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 600000000);
        format(string, sizeof(string), "Vehicle %s(%d) spawned.", VehNames[GetVehicleModel(carid)-400], carid);
        SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    if(DMZone[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"ERROR: You are in a DM Zone");
    return 1;
}
rep if you find it useful
Reply
#5

whats your stock of this :

pawn Код:
GetVehicleModelIDFromName
Reply
#6

pawn Код:
stock GetVehicleModelIDFromName(vehname[])
{
    for(new i = 0; i < 211; i++)
    {
        if (strfind(VehNames[i], vehname, true) != -1) return i + 400;
    }
    return -1;
}
Reply
#7

pawn Код:
CMD:car(playerid, params[])
{
    if(DMZone[playerid] == 0)
    {
        new string[256];
        new color1;
        new color2;
        new car;
        if(!sscanf(params, "iii",car,  color1, color2); return SendClientMessage(playerid, COLOR_GREY, "USAGE: /car [vehicleid|name] [color1] [color2]"), true;

        new Float:X,Float:Y,Float:Z,Float:A;
        GetPlayerPos(playerid, X,Y,Z);
        GetPlayerFacingAngle(playerid, A);
        X += (5 * floatsin(-A, degrees));
        Y += (5 * floatcos(-A, degrees));
        new car1 = GetVehicleModelIDFromName(car)
        CreateVehicle(car1, X,Y,Z, 0.0, color1, color2, 600000000);
        format(string, sizeof(string), "Vehicle %s(%d) spawned.", VehNames[GetVehicleModel(carid)-400], carid);
        SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    if(DMZone[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"ERROR: You are in a DM Zone");
    return 1;
}
try this
Reply
#8

C:\Users\EASYHOME\Desktop\FuriousDrifters\gamemode s\FD.pwn(3111) : error 035: argument type mismatch (argument 1)
C:\Users\EASYHOME\Desktop\FuriousDrifters\gamemode s\FD.pwn(3113) : error 017: undefined symbol "carid"
C:\Users\EASYHOME\Desktop\FuriousDrifters\gamemode s\FD.pwn(3103) : warning 203: symbol is never used: "car"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#9

pawn Код:
COMMAND:car(playerid, params[])
{
    if(DMZone[playerid] == 0)
    {
        new vehiclename, carcolour1, carcolour2;
        if(sscanf(params, "iii", vehiclename, carcolour1, carcolour2)) return SendClientMessage(playerid, 0xFF00FFFF, "[Incorrect Usage!] [Correct Usage]- /car (vehicle name) (colour1) colour2)");
        {
            new Float:X, Float:Y, Float:Z;
            GetPlayerPos(playerid, X, Y, Z);
            GetPlayerFacingAngle(playerid, A);
            X += (5 * floatsin(-A, degrees));
             Y += (5 * floatcos(-A, degrees));
            new model = GetVehicleModelIDFromName(vehiclename)
            AddStaticVehicleEx(model,X+2, Y+2, Z+5, 0, carcolour1, carcolour2, -1);
            PutPlayerInVehicle(playerid,model, 0);
            SetVehicleHealth(model, 998);
         }
     }
if(DMZone[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"ERROR: You are in a DM Zone");
    return 1;
}
Reply
#10

C:\Users\EASYHOME\Desktop\FuriousDrifters\gamemode s\FD.pwn(310 : error 035: argument type mismatch (argument 1)
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)