Truck Problem
#1

ca someone help??i dont want IsATLCar(Trucks) to respawn at /rac plz help!!

pawn Код:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0) //
                    {
                    if(IsPlayerConnected(playerid))
                    {
                    new carid = GetPlayerVehicleID(playerid);
                    if(PlayerInfo[playerid][pAdmin] < 1337)
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
                        return 1;
                    }
                    new bool:unwanted[CAR_AMOUNT];
                    for(new player=0; player<MAX_PLAYERS; player++)
                    {
                        if(IsPlayerInAnyVehicle(player))
                        {
                            unwanted[GetPlayerVehicleID(player)]=true;
                        }
                        if(IsATLCar(carid) || IsATrailer(carid))
                        {
                            unwanted[GetPlayerVehicleID(player)]=true;
                        }
                    }
                    for(new car = 1; car <= 359; car++)
                    {
                        if(!unwanted[car]) SetVehicleToRespawn(car);
                    }
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), " Toate vehicule sau respawnat de %s.", sendername);
                    BroadCast(COLOR_WHITE,string);
                    }
                    return 1;
                    }
Reply
#2

Try this:
pawn Код:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0) //
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            new bool:unwanted[CAR_AMOUNT];
            for(new player=0; player<MAX_PLAYERS; player++)
            {
                if(IsPlayerInAnyVehicle(player))
                {
                    unwanted[GetPlayerVehicleID(player)]=true;
                }
            }
            for(new car = 1; car <= 359; car++)
            {
                if(IsATLCar(car) || IsATrailer(car)) continue;
                if(!unwanted[car]) SetVehicleToRespawn(car);
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), " Toate vehicule sau respawnat de %s.", sendername);
            BroadCast(COLOR_WHITE,string);
        }
        return 1;
    }
You are searching for the vehicle id of the player who used the command /rac rather than all connected players...
Reply
#3

Hello Akcent, try that:
pawn Код:
if(!strcmp(cmd, "/respawnallcars", true) || !strcmp(cmd, "/rac", true)) //
{
    if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
    new bool:unwanted[CAR_AMOUNT];
    for(new player=0; player<MAX_PLAYERS; player++)
    {
        if(IsPlayerInAnyVehicle(player)) unwanted[GetPlayerVehicleID(player)]=true;
    }
    for(new car = 1; car < 400; car++)
    {
        if(!unwanted[car] && !IsATLCar(car) && !IsATrailer(car)) SetVehicleToRespawn(car);
    }
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), " Toate vehicule sau respawnat de %s.", sendername);
    BroadCast(COLOR_WHITE,string);
    return true;
}
Edit: You can do the code that the user above wrote.
Reply
#4

can you help me with this too?i want to respawn each car in the distance o 5 and il thank you

Quote:

if(strcmp(cmd, "/rcevent", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
SendClientMessage(playerid,COLOR_WHITE,"Ai respawnat masinile din jurul tau.");
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
if(GetDistanceBetweenPlayers(playerid,i) <5)
{
for(new car = 1; car <= 699; car++)
{
SetVehicleToRespawn(car);
}
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You do not have permission to use that command!");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You Must be logged in to use this command!");
}
return 1;
}

Reply
#5

http://forum.sa-mp.com/showpost.php?...23&postcount=6
Reply
#6

now how can i make only IsATLCar and IsATrailer respawn only those 2

Quote:

if(strcmp(cmd, "/rtt", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 1337)
{
SendClientMessage(playerid, COLOR_GRAD1, "** you are not authorized to use that command!");
return 1;
}
new bool:unwanted[MAX_VEHICLES];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i))
{
unwanted[GetPlayerVehicleID(i)] = true;
}
}
for(new car = 1; car <= 359; car++)
{
if(!unwanted[car])
{
SetVehicleToRespawn(car);
}
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Toate Masinile de la jobul 'Transport Lapte' sau respawnat de %s.", sendername);
BroadCast(COLOR_WHITE,string);
}
return 1;
}

Reply
#7

please help with last thing.. (
Reply
#8

anyone pleasee il give rep..
Reply
#9

Try this
pawn Код:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0) //
{
    if(PlayerInfo[playerid][pAdmin] < 1337)
        return SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");

    new bool:unwanted[MAX_VEHICLES];
    for(new player; player != MAX_PLAYERS; player++)
        if(IsPlayerInAnyVehicle(player) && !IsATLCar(GetPlayerVehicleID(player)))
            unwanted[GetPlayerVehicleID(player)] = true;

    for(new car = 1; car != MAX_VEHICLES; car++)
        if(!unwanted[car]) SetVehicleToRespawn(car);

    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), " Toate vehicule sau respawnat de %s.", sendername);
    BroadCast(COLOR_WHITE,string);
    return true;
}
Reply
#10

i fixed thx
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)