Gold Rims
#1

hey guys i want to add a /gr command to my server so that when a player typed /gr it applies gold rims to their car for a fee of 100000 dollars, but if they arent in a car make it say error you must be in a car and dont apply them unless they are thz
Reply
#2

Enjoy: and only admin can do it
Код HTML:
CMD:gr(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] <= 1)
 	{
		return SendClientMessageEx(playerid, COLOR_LIGHTRED, " You are not Authorized to use that command");
	}
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not driving a vehicle.");
	AddVehicleComponent(GetPlayerVehicleID(playerid),1080);
    SendClientMessage(playerid, 0xFFFFFFFF, "You have replaced your rims with gold rims.");
    return 1;
}
CMD:levelones(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] >= 2) {
   		SendClientMessageEx(playerid,COLOR_WHITE,"Listing all level ones...");

		new
			szNoobs[14 + MAX_PLAYER_NAME];

    	foreach(Player, i) if(PlayerInfo[i][pLevel] == 1) {
			format(szNoobs, sizeof(szNoobs), "* %s (ID %i)", GetPlayerNameEx(i), i);
			SendClientMessageEx(playerid, COLOR_WHITE, szNoobs);
		}
	}
	return 1;
}
Reply
#3

This is not scripting request thread.

Hint:
IsPlayerInAnyVehicle
AddVehicleCompoment
Reply
#4

i have one for an admin :P but i want one so that a normal player can do it but it will cost them money
Reply
#5

anyone?
Reply
#6

pawn Код:
CMD:gr(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in the driver seat!");
    else if(GetPlayerMoney(playerid) <= 100000) return SendClientMessage(playerid, 0xFFFFFFFF, "You need 100 000$ to get gold rims!");
   
    GivePlayerMoney(playerid, -100000);
    AddVehicleComponent(GetPlayerVehicleID(playerid),1080);
    SendClientMessage(playerid, 0xFFFFFFFF, "You have replaced your rims with gold rims.");
    return 1;
}
Reply
#7

Dan right on the spot, but i want someone to type the cmd /gr in then it will say warning:adding these will charge you 100 000 type the cmd again to confirm then it adds it, please?
Reply
#8

Enjoy!

On top of your script add:

pawn Код:
new IsWarned[MAX_PLAYERS] = 0;
And OnPlayerConnect:

pawn Код:
IsWarned[playerid] = 0;
pawn Код:
CMD:gr(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in the driver seat!");
    else if(GetPlayerMoney(playerid) <= 100000) return SendClientMessage(playerid, 0xFFFFFFFF, "You need 100 000$ to get gold rims!");
   
    else if(IsWarned[playerid] == 0)
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "Warning: This will remove 100 000$ from you. Type the command again to continue.");
        IsWarned[playerid] = 1;
    }
    else
    {
        IsWarned[playerid] = 0;
        GivePlayerMoney(playerid, -100000);
        AddVehicleComponent(GetPlayerVehicleID(playerid),1080);
        SendClientMessage(playerid, 0xFFFFFFFF, "You have replaced your rims with gold rims.");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)