Respawncars
#1

I was wondering if someone can help me make it so it doesn't respawn cars if someones in them, and when I respawn cars it takes my bot out for some odd reason.
+rep intended
pawn Код:
if(strcmp(cmd, "/respawncars", true) == 0)
        {
            if(IsPlayerConnected(playerid))
            {
                if(PlayerInfo[playerid][pAdmin] >= 3)
                {
                    for(new i = 0; i < MAX_VEHICLES; i++)
                    {
                        SetVehicleToRespawn(i);
                    }
                    SendClientMessageToAll(BLANCO, "Server: Vehicles respawned");
                    printf("Vehicle respawn");
                    for(new i = 0;i < MAX_PLAYERS; i++)
                    {
                        new npcname[MAX_PLAYER_NAME];
                        GetPlayerName(i, npcname, sizeof(npcname));
                        if(!strcmp(npcname,"Bot_Intro",true))
                        {
                            PutPlayerInVehicle(i,50, 0);
                            SetVehicleParamsEx(i, 1, 0, -1, 0, 0, 0, 0);
                            TogglePlayerControllable(i, true);
                            SetPlayerColor(i, BLANCO2);
                            gTeam[i] = EHUMANO;
                        }
                    }
                    for(new i = 0; i < MAX_VEHICLES; i++)
                    {
                        SetVehicleParamsEx(i, 0, 0, 0, 0, 0, 0, 0);
                    }
                }
                else
                {
                    SendClientMessage(playerid, ROJO_OSCURO, "   You dont got permission for this command");
                    return 1;
                }
            }
            return 1;
        }
Reply
#2

pawn Код:
if(strcmp(cmd, "/respawncars", true) == 0)
        {
            if(IsPlayerConnected(playerid))
            {
                if(PlayerInfo[playerid][pAdmin] >= 3)
                {
                    new IsVehicleOccupied[MAX_VEHICLES];
                    for(new x = 0; x<MAX_PLAYERS; x++)
                    {
                        new vehid = GetPlayerVehicleID(x);
                        if(vehid != 0) IsVehicleOccupied[vehid] ++;
                    }
                    for(new i = 0; i < MAX_VEHICLES; i++)
                    {
                        if(!IsVehicleOccupied[i]) SetVehicleToRespawn(i);
                    }
                    SendClientMessageToAll(BLANCO, "Server: Vehicles respawned");
                    printf("Vehicle respawn");
                    for(new i = 0;i < MAX_PLAYERS; i++)
                    {
                        new npcname[MAX_PLAYER_NAME];
                        GetPlayerName(i, npcname, sizeof(npcname));
                        if(!strcmp(npcname,"Bot_Intro",true))
                        {
                            PutPlayerInVehicle(i,50, 0);
                            SetVehicleParamsEx(i, 1, 0, -1, 0, 0, 0, 0);
                            TogglePlayerControllable(i, true);
                            SetPlayerColor(i, BLANCO2);
                            gTeam[i] = EHUMANO;
                        }
                    }
                    for(new i = 0; i < MAX_VEHICLES; i++)
                    {
                        SetVehicleParamsEx(i, 0, 0, 0, 0, 0, 0, 0);
                    }
                }
                else
                {
                    SendClientMessage(playerid, ROJO_OSCURO, "   You dont got permission for this command");
                    return 1;
                }
            }
            return 1;
        }
Could just do that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)