SA-MP Forums Archive
Respawn vehicle command not working - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Respawn vehicle command not working (/showthread.php?tid=202886)



Respawn vehicle command not working [Solved] - admantis - 25.12.2010

Hello everybody. I had this bug the past weeks with this specific command.
pawn Код:
if(strcmp(cmdtext,"/rtv",true)==0)
    {
        if(PlayerInfo[playerid][pAdminLevel] > 1 && PlayerInfo[playerid][pIsGolden] == 1)
        {
            if (!IsPlayerInAnyVehicle(playerid))
            {
                SendClientMessage(playerid,COLOR_RED,"AdmCmd: You must be in a vehicle to use this command.");
            }
            else
            {
                new veh = GetVehicleModel(GetPlayerVehicleID(playerid));
                SetVehicleToRespawn(veh);
            }
            return 1;
        }
        else return SendClientMessage(playerid,COLOR_GRAY,"You don't have authorization.");
    }
No errors, no warnings, but when I type it ingame it doesn't do anything at all.
Any help, please?


Re: Respawn vehicle command not working - blackwave - 25.12.2010

pawn Код:
if(strcmp("/rtv",cmdtext, true, 10) == 0)
    {
        if(PlayerInfo[playerid][pAdminLevel] > 1 && PlayerInfo[playerid][pIsGolden] == 1)
        {
            if (IsPlayerInAnyVehicle(playerid))
            {
                new veh = GetVehicleModel(GetPlayerVehicleID(playerid));
                SetVehicleToRespawn(veh);
            }
            else
            {
              SendClientMessage(playerid,COLOR_RED,"AdmCmd: You must be in a vehicle to use this command.");
               
            }
            return 1;
        }
        else return SendClientMessage(playerid,COLOR_GRAY,"You don't have authorization.");
    }



Respuesta: Re: Respawn vehicle command not working - admantis - 25.12.2010

Quote:
Originally Posted by blackwave
Посмотреть сообщение
pawn Код:
if(strcmp("/rtv",cmdtext, true, 10) == 0)
    {
        if(PlayerInfo[playerid][pAdminLevel] > 1 && PlayerInfo[playerid][pIsGolden] == 1)
        {
            if (IsPlayerInAnyVehicle(playerid))
            {
                new veh = GetVehicleModel(GetPlayerVehicleID(playerid));
                SetVehicleToRespawn(veh);
            }
            else
            {
              SendClientMessage(playerid,COLOR_RED,"AdmCmd: You must be in a vehicle to use this command.");
               
            }
            return 1;
        }
        else return SendClientMessage(playerid,COLOR_GRAY,"You don't have authorization.");
    }
There's no difference other than the order! Thank you, but it's not working. When im not in a vehicle it shows the error message, if im in one, nothing happens.
Should be this
pawn Код:
new veh = GetVehicleModel(GetPlayerVehicleID(playerid));
                SetVehicleToRespawn(veh);
So anybody?


Respuesta: Respawn vehicle command not working - admantis - 25.12.2010

Sorry for double post, I fixed this myself. I changed
pawn Код:
new veh = GetVehicleModel(GetPlayerVehicleID(playerid));
to
pawn Код:
new veh = GetPlayerVehicleID(playerid);



Re: Respawn vehicle command not working - Mean - 25.12.2010

pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleModel(vehicleid);