/createpvehicle help
#1

Can any one make for me that cmd for rp servers?

I'm using ZCMD

This cmd to make for someone a car

Thanks
Reply
#2

Код:
CMD:createpvehicle(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] < 4)
	{
        SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");
        return 1;
    }

    new string[128], giveplayerid, modelid, color1, color2;
    if(sscanf(params, "iddd", giveplayerid, modelid, color1, color2)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /createpvehicle [playerid] [modelid] [color 1] [color 2]");

    if(color1 < 0 || color1 > 126) { SendClientMessageEx(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 126 !"); return 1; }
    if(color2 < 0 || color2 > 126) { SendClientMessageEx(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 126 !"); return 1; }
    if(modelid < 400 || modelid > 611) { SendClientMessageEx(playerid, COLOR_GREY, "   Vehicle Number can't be below 400 or above 611 !"); return 1; }
    new playervehicleid = GetPlayerFreeVehicleId(giveplayerid);
    if(playervehicleid == -1) return SendClientMessageEx(playerid, COLOR_GREY, "ERROR: That player can't have more cars.");
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(giveplayerid,X,Y,Z);
    new Float:Angle;
    GetPlayerFacingAngle(giveplayerid,Angle);
    new car = CreatePlayerVehicle(giveplayerid, playervehicleid, modelid, X, Y, Z, Angle, color1, color2, 0);
    if(car == INVALID_PLAYER_VEHICLE_ID)
	{
        SendClientMessageEx(playerid, COLOR_GREY, "ERROR: Something went wrong and the car didn't get created.");
    }
    else
	{
        format(string, sizeof(string), " Vehicle successfully created with ID %d.", car);
        SendClientMessageEx(playerid, COLOR_GRAD1, string);
    }

    format(string, sizeof(string), "%s has created a %s for %s (Color 1: %d | Color 2: %d).", GetPlayerNameEx(playerid), GetVehicleName(car), GetPlayerNameEx(giveplayerid), color1, color2);
    Log("logs/playervehicle.log", string);
    return 1;
}
Reply
#3

It doesnt work

Код:
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27085) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27089) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27090) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27092) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27093) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27094) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27095) : error 017: undefined symbol "GetPlayerFreeVehicleId"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27096) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27101) : error 017: undefined symbol "CreatePlayerVehicle"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27102) : error 017: undefined symbol "INVALID_PLAYER_VEHICLE_ID"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27104) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27109) : error 017: undefined symbol "SendClientMessageEx"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27112) : error 017: undefined symbol "GetPlayerNameEx"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27113) : error 017: undefined symbol "Log"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


13 Errors.
Help
Reply
#4

It does work, just add the defines.
Reply
#5

Give me the defines please?
Reply
#6

Helpp...
Reply
#7

pawn Код:
CMD:createpvehicle(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 4)
    {
        SendClientMessage(playerid, COLOR_GREY, "You're not allowed to use this command.");
        return true;
    }
    if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 5)
    {
        SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
        return true;
    }
    new string[128], giveplayerid, modelid, color1, color2;
    if(sscanf(params, "uddd", giveplayerid, modelid, color1, color2)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createpvehicle [playerid/partofname] [modelid] [color 1] [color 2]");

    if(AdminDuty[giveplayerid] == 1)
    {
        SendClientMessage(playerid,COLOR_WHITE, "You can't use that command on an on-duty admin.");
        return true;
    }

    if(color1 < 0 || color1 > 255) { SendClientMessage(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 255!"); return true; }
    if(color2 < 0 || color2 > 255) { SendClientMessage(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 255!"); return true; }
    if(modelid < 400 || modelid > 611) { SendClientMessage(playerid, COLOR_GREY, "   Vehicle Number can't be below 400 or above 611!"); return true; }
    new playervehicleid = GetPlayerFreeVehicleId(giveplayerid),
        totalvehicles = GetPlayerVehicleCountEx(giveplayerid);

    if(PlayerInfo[giveplayerid][pDonator] == 0 && totalvehicles >= 5) //PlayerInfo[giveplayerid][pTempDonator] > 0) && carsamount >= 5)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player can't have more cars, non-donator can only own 5 cars.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] == 1 && totalvehicles >= 7)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player can't have more cars, Ruby Donator can only own 7 cars.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] == 2 && totalvehicles >= 8)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player can't have more cars, Sapphire Donator can only own 8 cars.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] == 3 && totalvehicles >= 10)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player can't have more cars, Diamond Donator can only own 10 cars.");
        return true;
    }

    if(playervehicleid == -1) return SendClientMessage(playerid, COLOR_GREY, "ERROR: That player can't have more cars.");
    if(PlayerInfo[giveplayerid][pDonator] == 0 && VehicleSpawned[giveplayerid] > 0)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player is non-donator and can only have 1 vehicle spawned. The player must store that vehicle in order to create a new one.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] == 1 && VehicleSpawned[giveplayerid] > 1)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player is Ruby Donator and can only have 2 vehicles spawned. The player must store that vehicle in order to create a new one.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] == 2 && VehicleSpawned[giveplayerid] > 2)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player is Sapphire Donator and can only have 3 vehicles spawned. The player must store a vehicle in order to create a new one.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] == 3 && VehicleSpawned[giveplayerid] > 3)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player is Diamond Donator and can only have 4 vehicles spawned. The player must store a vehicle in order to create a new one.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] < 0 || PlayerInfo[giveplayerid][pDonator] > 3)
    {
        SendClientMessage(playerid, COLOR_GREY, "ERROR: That player has an invalid Donator level.");
        return true;
    }

    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(giveplayerid,X,Y,Z);
    new Float:Angle;
    GetPlayerFacingAngle(giveplayerid,Angle);
    new car = CreatePlayerVehicle(giveplayerid, playervehicleid, modelid, X, Y, Z, Angle, color1, color2, 0);
    if(car == INVALID_PLAYER_VEHICLE_ID)
    {
        SendClientMessage(playerid, COLOR_GREY, "ERROR: Something went wrong and the car didn't get created.");
    }
    else
    {
        format(string, sizeof(string), " Vehicle successfully created with ID %d.", car);
        SendClientMessage(playerid, COLOR_GRAD1, string);
    }

    format(string, sizeof(string), "%s has created a %s for %s (Color 1: %d | Color 2: %d).", GetPlayerNameEx(playerid), GetVehicleName(car), GetPlayerNameEx(giveplayerid), color1, color2);
    Log("logs/playervehicle.log", string);
    return true;
}
This one should work as I'm using it myself.
Reply
#8

pawn Код:
CMD:createpvehicle(playerid, params[])
{
    new
        modelid;
       
    if (sscanf(params, "i", modelid)) return SendClientMessage(playerid, -1, "Usage: /createpvehicle <modelid>");
    if (400 <= modelid <= 611) return SendClientMessage( playerid, -1, "Invalid modelid: 400-611");

    new
        Float: x,
        Float: y,
        Float: z,
        vehicleid;

    GetPlayerPos(playerid, x, y, z);

    vehicleid = CreateVehicle(modelid, x + 2.0, y + 2.0, z, 0.0, random(256), random(256), 60);
    LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
    SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
    //PutPlayerInVehicle(playerid, vehicleid, 0);
    return 1;
}
Reply
#9

Quote:

This one should work as I'm using it myself.

Код:
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27088) : error 017: undefined symbol "AdminDuty"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27088) : warning 215: expression has no effect
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27088) : error 001: expected token: ";", but found "]"
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27088) : error 029: invalid expression, assumed zero
C:\Users\Mido\Desktop\Project Evolution Roleplay\Los Santos Public Roleplay [0.3x]\gamemodes\PERP.pwn(27088) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
......... Help
Reply
#10

Quote:
Originally Posted by stundje
Посмотреть сообщение
pawn Код:
CMD:createpvehicle(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 4)
    {
        SendClientMessage(playerid, COLOR_GREY, "You're not allowed to use this command.");
        return true;
    }
    if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 5)
    {
        SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
        return true;
    }
    new string[128], giveplayerid, modelid, color1, color2;
    if(sscanf(params, "uddd", giveplayerid, modelid, color1, color2)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createpvehicle [playerid/partofname] [modelid] [color 1] [color 2]");

    if(AdminDuty[giveplayerid] == 1)
    {
        SendClientMessage(playerid,COLOR_WHITE, "You can't use that command on an on-duty admin.");
        return true;
    }

    if(color1 < 0 || color1 > 255) { SendClientMessage(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 255!"); return true; }
    if(color2 < 0 || color2 > 255) { SendClientMessage(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 255!"); return true; }
    if(modelid < 400 || modelid > 611) { SendClientMessage(playerid, COLOR_GREY, "   Vehicle Number can't be below 400 or above 611!"); return true; }
    new playervehicleid = GetPlayerFreeVehicleId(giveplayerid),
        totalvehicles = GetPlayerVehicleCountEx(giveplayerid);

    if(PlayerInfo[giveplayerid][pDonator] == 0 && totalvehicles >= 5) //PlayerInfo[giveplayerid][pTempDonator] > 0) && carsamount >= 5)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player can't have more cars, non-donator can only own 5 cars.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] == 1 && totalvehicles >= 7)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player can't have more cars, Ruby Donator can only own 7 cars.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] == 2 && totalvehicles >= 8)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player can't have more cars, Sapphire Donator can only own 8 cars.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] == 3 && totalvehicles >= 10)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player can't have more cars, Diamond Donator can only own 10 cars.");
        return true;
    }

    if(playervehicleid == -1) return SendClientMessage(playerid, COLOR_GREY, "ERROR: That player can't have more cars.");
    if(PlayerInfo[giveplayerid][pDonator] == 0 && VehicleSpawned[giveplayerid] > 0)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player is non-donator and can only have 1 vehicle spawned. The player must store that vehicle in order to create a new one.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] == 1 && VehicleSpawned[giveplayerid] > 1)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player is Ruby Donator and can only have 2 vehicles spawned. The player must store that vehicle in order to create a new one.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] == 2 && VehicleSpawned[giveplayerid] > 2)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player is Sapphire Donator and can only have 3 vehicles spawned. The player must store a vehicle in order to create a new one.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] == 3 && VehicleSpawned[giveplayerid] > 3)
    {
        SendClientMessage(playerid, COLOR_GREY, "That player is Diamond Donator and can only have 4 vehicles spawned. The player must store a vehicle in order to create a new one.");
        return true;
    }
    if(PlayerInfo[giveplayerid][pDonator] < 0 || PlayerInfo[giveplayerid][pDonator] > 3)
    {
        SendClientMessage(playerid, COLOR_GREY, "ERROR: That player has an invalid Donator level.");
        return true;
    }

    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(giveplayerid,X,Y,Z);
    new Float:Angle;
    GetPlayerFacingAngle(giveplayerid,Angle);
    new car = CreatePlayerVehicle(giveplayerid, playervehicleid, modelid, X, Y, Z, Angle, color1, color2, 0);
    if(car == INVALID_PLAYER_VEHICLE_ID)
    {
        SendClientMessage(playerid, COLOR_GREY, "ERROR: Something went wrong and the car didn't get created.");
    }
    else
    {
        format(string, sizeof(string), " Vehicle successfully created with ID %d.", car);
        SendClientMessage(playerid, COLOR_GRAD1, string);
    }

    format(string, sizeof(string), "%s has created a %s for %s (Color 1: %d | Color 2: %d).", GetPlayerNameEx(playerid), GetVehicleName(car), GetPlayerNameEx(giveplayerid), color1, color2);
    Log("logs/playervehicle.log", string);
    return true;
}
This one should work as I'm using it myself.
I see you're using Horizon Gaming Leaked Code.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)