SA-MP Forums Archive
Vehicle despawning - Gifts included - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle despawning - Gifts included (/showthread.php?tid=287508)



Vehicle despawning - Gifts included - Swizzzy - 03.10.2011

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;
}



Re: Vehicle despawning - Gifts included - Zonoya - 03.10.2011

Код:
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


Re: Vehicle despawning - Gifts included - Pharrel - 03.10.2011

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;
}



Re: Vehicle despawning - Gifts included - Zonoya - 03.10.2011

same as ^ mine was wrong lol