Give all players a car?
#1

I'm using LuxAdmin, i notice it has a similar command to only give 1 specific player a car, but how do i automatically give everyone a car?

This is what LuxAdmin has, so please configure it and make it put EVERYONE into a car.

pawn Код:
dcmd_givecar(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
    {
        if(!strlen(params)) return
        SendClientMessage(playerid, LIGHTBLUE2, "Usage: /givecar [PlayerID]") &&
        SendClientMessage(playerid, orange, "Function: Will give a Car for specified player");
        new player1 = strval(params);
        new string[128];
        new playername[MAX_PLAYER_NAME];
        new adminname[MAX_PLAYER_NAME];
        if(AccInfo[player1][Level] == ServerInfo[MaxAdminLevel] && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
        return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerInAnyVehicle(player1))
        return SendClientMessage(playerid,red,"ERROR: Player already has a vehicle");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid)
         {
            SendCommandToAdmins(playerid,"GiveCar");
            new Float:x, Float:y, Float:z;
            GetPlayerPos(player1,x,y,z);
            CarSpawner(player1,415);
            GetPlayerName(player1, playername, sizeof(playername));
            GetPlayerName(playerid, adminname, sizeof(adminname));
            format(string,sizeof(string),"|- Administrator %s has given you a car",adminname);
            SendClientMessage(player1,blue,string);
            format(string,sizeof(string),"You have given %s a car", playername);
            return SendClientMessage(playerid,BlueMsg,string);
        }
        else return ErrorMessages(playerid, 4);
    }
    else return ErrorMessages(playerid, 1);
}
Reply
#2

Hello there
You are either not skilled enough or lazy enough for such easy transform?
Well.. Not my problem, though.

pawn Код:
dcmd_givecar(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
    {
        for(new iPlayer = 0; iPlayer != MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(iPlayer))
            {
                // Major code goes here.
                SendCommandToAdmins(playerid,"GiveCar");
                new
                    Float:x,
                    Float:y,
                    Float:z,
                    tmpVehId
                ;
                GetPlayerPos(player1,x,y,z);
               
                if(IsPlayerInAnyVehicle(iPlayer))
                {
                    tmpVehId = GetPlayerVehicleID(iPlayer);
                    RemovePlayerFromVehicle(iPlayer);
                    SetVehicleToRespawn(tmpVehId);
                }
                CarSpawner(player1,415);
            }
        }
    }
}
This code gives all player vehicle via CarSpawner(id, vehid) (perhaps??)
Making it look more cooler or add some more stuff - its all on your hands now.

Greetz,
LetsOWN
Reply
#3

i wnt to put this for my freeroam server.

but i did that and got like.. few errors?

pawn Код:
error 017: undefined symbol "i"
error 017: undefined symbol "player1"
error 017: undefined symbol "player1"
warning 203: symbol is never used: "params"
and thanks for helping.and yes im vry baad at codeing.
Reply
#4

Have you added anything into code I gave you?
If yes, please show it here.

Greetz,
LetsOWN
Reply
#5

Quote:
Originally Posted by LetsOWN[PL]
Посмотреть сообщение
Have you added anything into code I gave you?
If yes, please show it here.

Greetz,
LetsOWN
No i did not. Never mind, it doesn't matter.

Thanks for helping though.
Reply
#6

pawn Код:
dcmd_givecar(playerid,params[])
{
    #pragma unused params
    if(AccInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
    {
        for(new iPlayer = 0; iPlayer != MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(iPlayer))
            {
                SendCommandToAdmins(playerid,"GiveCar");
                new
                    Float:x,
                    Float:y,
                    Float:z,
                    tmpVehId
                ;
                GetPlayerPos(iPlayer,x,y,z);

                if(IsPlayerInAnyVehicle(iPlayer))
                {
                    tmpVehId = GetPlayerVehicleID(iPlayer);
                    RemovePlayerFromVehicle(iPlayer);
                    SetVehicleToRespawn(tmpVehId);
                }
                CarSpawner(iPlayer,415);
            }
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)