[HELP] Respawn a certain carid?
#1

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
Reply
#2

https://sampwiki.blast.hk/wiki/SetVehicleToRespawn
Reply
#3

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;
    }
Reply
#4

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".
Reply
#5

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?
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)