SA-MP Forums Archive
[HELP] Respawn a certain carid? - 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: [HELP] Respawn a certain carid? (/showthread.php?tid=187549)



[HELP] Respawn a certain carid? - Fredden1993 - 03.11.2010

Hello,

I'm trying to make a respawn command for faction leaders to respawn his or her faction vehicles. In this case the carid is 598.

Thanks


Re: [HELP] Respawn a certain carid? - woot - 03.11.2010

https://sampwiki.blast.hk/wiki/SetVehicleToRespawn


Re: [HELP] Respawn a certain carid? - Fredden1993 - 03.11.2010

Quote:
Originally Posted by exora
Посмотреть сообщение
Did I get it wrong or should it look like this... if it should, it doesn't work.

pawn Код:
if(strcmp(cmd, "/respawnfactioncars", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pLeader] == 1)
            {
                for(new i = 0; i < MAX_VEHICLES; i++)
                {
                    SetVehicleToRespawn(598);
                }
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "** %s has respawned all faction vehicles. **", sendername);
                SendTeamMessage(1, COLOR_RED, string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "    You are not authorized to use that command.");
            }
        }
        return 1;
    }



Re: [HELP] Respawn a certain carid? - iggy1 - 03.11.2010

pawn Код:
if(strcmp(cmd, "/respawnfactioncars", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pLeader] == 1)
            {
                for(new i = 0; i < MAX_VEHICLES; i++)
                {
                    SetVehicleToRespawn(i);
                }
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "** %s has respawned all faction vehicles. **", sendername);
                SendTeamMessage(1, COLOR_RED, string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "    You are not authorized to use that command.");
            }
        }
        return 1;
    }
The parameter inside "SetVehicleToRespawn" should have been '"i".


Re: [HELP] Respawn a certain carid? - Fredden1993 - 03.11.2010

Quote:
Originally Posted by iggy1
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/respawnfactioncars", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pLeader] == 1)
            {
                for(new i = 0; i < MAX_VEHICLES; i++)
                {
                    SetVehicleToRespawn(i);
                }
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "** %s has respawned all faction vehicles. **", sendername);
                SendTeamMessage(1, COLOR_RED, string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "    You are not authorized to use that command.");
            }
        }
        return 1;
    }
The parameter inside "SetVehicleToRespawn" should have been '"i".
But how does the command know what carid's to respawn?


Re: [HELP] Respawn a certain carid? - iggy1 - 03.11.2010

Its not the vehicle id you want its the modelid (i think) use GetVehicleModel like this
pawn Код:
if(strcmp(cmd, "/respawnfactioncars", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pLeader] == 1)
            {
                for(new i = 0; i < MAX_VEHICLES; i++)
                {
                    if(GetVehicleModel(i) == 598)
                    {
                        SetVehicleToRespawn(i);
                    }
                }
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "** %s has respawned all faction vehicles. **", sendername);
                SendTeamMessage(1, COLOR_RED, string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "    You are not authorized to use that command.");
            }
        }
        return 1;
    }