Vehicle despawning - Gifts included
#1

Well i basically need a code for despawning the created vehicles, Heres the code i came up with so far.

Help with be of great appreciation.


CODE


pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

    new Float:x, Float:y, Float:z;
    if(dialogid == DIALOG_VEHMENU)//Weapon System Dialog
    {
        if(response == 0) return SendClientMessage(playerid, COLOR_RED, "SERVR: You exited the the vehicle system");
        switch(listitem)
        {
            case 0:
            {
                new string[64], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
                format(string, sizeof string, "AdmCMD: Admin : %s has spawned a BMX.",pName);
                SendClientMessageToAll(COLOR_BRIGHTRED, string);
                GetPlayerPos(playerid,x,y,z);
                CreateVehicle(481,x-3.0,y,z,0.0,1,1,300);//HERE
            }
            case 1:
            {
                new string[64], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
                format(string, sizeof string, "AdmCMD: Admin : %s has spawned a Sultan.",pName);
                SendClientMessageToAll(COLOR_BRIGHTRED, string);
                GetPlayerPos(playerid,x,y,z);
                CreateVehicle(560,x-3.0,y,z,0.0,1,1,300);//HERE//Here
            }
            case 2:
            {
                new string[64], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
                format(string, sizeof string, "AdmCMD: Admin : %s has spawned a Greenwood.",pName);
                SendClientMessageToAll(COLOR_BRIGHTRED, string);
                GetPlayerPos(playerid,x,y,z);
                CreateVehicle(492,x-3.0,y,z,0.0,1,1,300);//HERE//Here
            }
            case 3:
            {
                new string[64], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
                format(string, sizeof string, "AdmCMD: Admin : %s has spawned a Turismo.",pName);
                SendClientMessageToAll(COLOR_BRIGHTRED, string);
                GetPlayerPos(playerid,x,y,z);
                CreateVehicle(492,x-3.0,y,z,0.0,1,1,300);//HERE//Here//Here
            }
            case 4:
            {
                //Something
            }
        }
    }
    return 1;
}
Reply
#2

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new vehicle;
    new Float:x, Float:y, Float:z;
    if(dialogid == DIALOG_VEHMENU)//Weapon System Dialog
    {
        if(response == 0) return SendClientMessage(playerid, COLOR_RED, "SERVR: You exited the the vehicle system");
        switch(listitem)
        {
            case 0:
            {
                new string[64], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
                format(string, sizeof string, "AdmCMD: Admin : %s has spawned a BMX.",pName);
                SendClientMessageToAll(COLOR_BRIGHTRED, string);
                GetPlayerPos(playerid,x,y,z);
                vehicle = CreateVehicle(481,x-3.0,y,z,0.0,1,1,300);//HERE
            }
            case 1:
            {
                new string[64], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
                format(string, sizeof string, "AdmCMD: Admin : %s has spawned a Sultan.",pName);
                SendClientMessageToAll(COLOR_BRIGHTRED, string);
                GetPlayerPos(playerid,x,y,z);
                vehicle = CreateVehicle(560,x-3.0,y,z,0.0,1,1,300);//HERE//Here
            }
            case 2:
            {
                new string[64], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
                format(string, sizeof string, "AdmCMD: Admin : %s has spawned a Greenwood.",pName);
                SendClientMessageToAll(COLOR_BRIGHTRED, string);
                GetPlayerPos(playerid,x,y,z);
                vehicle = CreateVehicle(492,x-3.0,y,z,0.0,1,1,300);//HERE//Here
            }
            case 3:
            {
                new string[64], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
                format(string, sizeof string, "AdmCMD: Admin : %s has spawned a Turismo.",pName);
                SendClientMessageToAll(COLOR_BRIGHTRED, string);
                GetPlayerPos(playerid,x,y,z);
                vehicle = CreateVehicle(492,x-3.0,y,z,0.0,1,1,300);//HERE//Here//Here
            }
            case 4:
            {
                DestroyVehicle(vehicle);
            }
        }
    }
    return 1;
}
if u select the 4th one it will delete all cars u spawned
Reply
#3

pawn Код:
new vehicle[MAX_PLAYERS][4];//global variable
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new Float:x, Float:y, Float:z;
    if(dialogid == DIALOG_VEHMENU)//Weapon System Dialog
    {
        if(response == 0) return SendClientMessage(playerid, COLOR_RED, "SERVR: You exited the the vehicle system");
        switch(listitem)
        {
            case 0:
            {
                new string[64], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
                format(string, sizeof string, "AdmCMD: Admin : %s has spawned a BMX.",pName);
                SendClientMessageToAll(COLOR_BRIGHTRED, string);
                GetPlayerPos(playerid,x,y,z);
                vehicle[playerid][0] = CreateVehicle(481,x-3.0,y,z,0.0,1,1,300);//HERE
            }
            case 1:
            {
                new string[64], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
                format(string, sizeof string, "AdmCMD: Admin : %s has spawned a Sultan.",pName);
                SendClientMessageToAll(COLOR_BRIGHTRED, string);
                GetPlayerPos(playerid,x,y,z);
                vehicle[playerid][1] = CreateVehicle(560,x-3.0,y,z,0.0,1,1,300);//HERE//Here
            }
            case 2:
            {
                new string[64], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
                format(string, sizeof string, "AdmCMD: Admin : %s has spawned a Greenwood.",pName);
                SendClientMessageToAll(COLOR_BRIGHTRED, string);
                GetPlayerPos(playerid,x,y,z);
                vehicle[playerid][2] = CreateVehicle(492,x-3.0,y,z,0.0,1,1,300);//HERE//Here
            }
            case 3:
            {
                new string[64], pName[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
                format(string, sizeof string, "AdmCMD: Admin : %s has spawned a Turismo.",pName);
                SendClientMessageToAll(COLOR_BRIGHTRED, string);
                GetPlayerPos(playerid,x,y,z);
                vehicle[playerid][3] = CreateVehicle(492,x-3.0,y,z,0.0,1,1,300);//HERE//Here//Here
            }
            case 4:
            {
                DestroyVehicle(vehicle[playerid][0]);
                DestroyVehicle(vehicle[playerid][1]);
                DestroyVehicle(vehicle[playerid][2]);
                DestroyVehicle(vehicle[playerid][3]);
            }
        }
    }
    return 1;
}
Reply
#4

same as ^ mine was wrong lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)