[HELP] Buy wheels
#1

Deleted
Reply
#2

Show how you check a player's vehicle, and faction vehicles.
Reply
#3

Here is another CMD , this have that system anti factions cars and cant spray another car . Here the link : http://pastebin.com/7N5HbD8v
Reply
#4

Can anyone help me ?
Reply
#5

USE THIS ONE:

CMD:buyrims(playerid, params[])
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid,0xFF0000AA,"You must be driver to use this command.");
if(PlayerInfo[playerid][pLevel] >= 1)
{
/*if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid,COLOR_WHITE, "You aren't ON-DUTY.");
return 1;
}*/
if(!IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GRAD1, " You are not in the vehicle / You are not the driver");
{
new string[128], rims;
if(sscanf(params, "d", rims))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USE: /buyrims [rimsid]");
SendClientMessageEx(playerid, COLOR_GRAD4, "|1 Cutter |2 Shadow |3 Rimshine |4 Wires |5 Classic |6 Twist");
SendClientMessageEx(playerid, COLOR_GRAD2, "|7 Gold Rims |8 Dollar |9 Grove |10 Import ");
SendClientMessageEx(playerid, COLOR_ORANGE, " Be sure to have $30000 in hand to buy rims for your vehicle");
return 1;
}
switch (rims)
{
case 1:
{
if (GetPlayerCash(playerid) >= 30000)
{
GivePlayerCash(playerid, -30000);
AddVehicleComponent(GetPlayerVehicleID(playerid), 1079);
SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
}
}
case 2:
{
if (GetPlayerCash(playerid) >= 30000)
{
GivePlayerCash(playerid, -30000);
AddVehicleComponent(GetPlayerVehicleID(playerid), 1073);
SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
}
}
case 3:
{
if (GetPlayerCash(playerid) >= 30000)
{
GivePlayerCash(playerid, -30000);
AddVehicleComponent(GetPlayerVehicleID(playerid), 1075);
SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
}
}
case 4:
{
if (GetPlayerCash(playerid) >= 30000)
{
GivePlayerCash(playerid, -30000);
AddVehicleComponent(GetPlayerVehicleID(playerid), 1076);
SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
}
}
case 5:
{
if (GetPlayerCash(playerid) >= 30000)
{
GivePlayerCash(playerid, -30000);
AddVehicleComponent(GetPlayerVehicleID(playerid), 1077);
SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
}
}
case 6:
{
if (GetPlayerCash(playerid) >= 30000)
{
GivePlayerCash(playerid, -30000);
AddVehicleComponent(GetPlayerVehicleID(playerid), 107;
SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
}
}
case 7:
{
if (GetPlayerCash(playerid) >= 30000)
{
GivePlayerCash(playerid, -30000);
AddVehicleComponent(GetPlayerVehicleID(playerid), 1080);
SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
}
}
case 8:
{
if (GetPlayerCash(playerid) >= 30000)
{
GivePlayerCash(playerid, -30000);
AddVehicleComponent(GetPlayerVehicleID(playerid), 1083);
SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
}
}
case 9:
{
if (GetPlayerCash(playerid) >= 30000)
{
GivePlayerCash(playerid, -30000);
AddVehicleComponent(GetPlayerVehicleID(playerid), 1081);
SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
}
}
case 10:
{
if (GetPlayerCash(playerid) >= 30000)
{
GivePlayerCash(playerid, -30000);
AddVehicleComponent(GetPlayerVehicleID(playerid), 1082);
SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
}
}
default:
{
format(string, sizeof(string), " Invalid rims", rims);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You can't use this command!");
}
return 1;
}
Reply
#6

There you go.

Код:
CMD:buyrims(playerid, params[])
{
    if(PlayerInfo[playerid][pLevel] >= 1)
	{
		/*if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
	    {
	        SendClientMessage(playerid,COLOR_WHITE, "You aren't ON-DUTY.");
			return 1;
	    }*/
		
		if(!IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GRAD1, " You are not in the vehicle / You are not the driver");
		{
			new iPlayer = -1, iVeh;
			foreach(Player, i)
			{
                iPlayerVeh = GetPlayerVehicle(i, iVeh);
                if(iPlayerVeh != -1) 
				{
                        if(i != playerid) return SendClientMessage(playerid,COLOR_GREY,"You cannot change rims of vehicles that do not belong to you.");
                }
			}
			if(iPlayerVeh == -1) return SendClientMessage(playerid, COLOR_GREY, "You cannot change rims of vehicles that do not belong to you.")
			new string[128], rims;
			if(sscanf(params, "d", rims))
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "USE: /buyrims [rimsid]");
				SendClientMessageEx(playerid, COLOR_GRAD4, "|1 Cutter |2 Shadow |3 Rimshine |4 Wires |5 Classic |6 Twist");
				SendClientMessageEx(playerid, COLOR_GRAD2, "|7 Gold Rims |8 Dollar |9 Grove |10 Import ");
				SendClientMessageEx(playerid, COLOR_ORANGE, " Be sure to have $30000 in hand to buy rims for your vehicle");
				return 1;
			}
			switch (rims)
			{
				case 1:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1079);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 2:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1073);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 3:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1075);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 4:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1076);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 5:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1077);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 6:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1078);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 7:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1080);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 8:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1083);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 9:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1081);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 10:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1082);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				default:
				{
					format(string, sizeof(string), "   Invalid rims", rims);
				}
			}
		}
	}
	else
	{
	    SendClientMessage(playerid, COLOR_GRAD1, "You can't use this command!");
	}
	return 1;
}

Edit:
Quote:
Originally Posted by kyriakos587
Посмотреть сообщение
USE THIS ONE:

CMD:buyrims(playerid, params[])
{
blabla3long5me
}
Won't work as OP wants it.
Reply
#7

Here dont have what i said , i need players cant buy rims if they dont own that car , and they cant use that cmd in the lspd cars
Reply
#8

maramizo i will test it

error 001: expected token: ";", but found "new"

Code : new string[128], rims;
if(sscanf(params, "d", rims))
Reply
#9

Quote:
Originally Posted by RedCode
Посмотреть сообщение
maramizo i will test it

error 001: expected token: ";", but found "new"

Code : new string[128], rims;
if(sscanf(params, "d", rims))
My bad, forgot a semi-colon, lmao.
Код:
CMD:buyrims(playerid, params[])
{
    if(PlayerInfo[playerid][pLevel] >= 1)
	{
		/*if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
	    {
	        SendClientMessage(playerid,COLOR_WHITE, "You aren't ON-DUTY.");
			return 1;
	    }*/
		
		if(!IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GRAD1, " You are not in the vehicle / You are not the driver");
		{
			new iPlayer = -1, iVeh;
			foreach(Player, i)
			{
                iPlayerVeh = GetPlayerVehicle(i, iVeh);
                if(iPlayerVeh != -1) 
				{
                        if(i != playerid) return SendClientMessage(playerid,COLOR_GREY,"You cannot change rims of vehicles that do not belong to you.");
                }
			}
			if(iPlayerVeh == -1) return SendClientMessage(playerid, COLOR_GREY, "You cannot change rims of vehicles that do not belong to you.");
			new string[128], rims;
			if(sscanf(params, "d", rims))
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "USE: /buyrims [rimsid]");
				SendClientMessageEx(playerid, COLOR_GRAD4, "|1 Cutter |2 Shadow |3 Rimshine |4 Wires |5 Classic |6 Twist");
				SendClientMessageEx(playerid, COLOR_GRAD2, "|7 Gold Rims |8 Dollar |9 Grove |10 Import ");
				SendClientMessageEx(playerid, COLOR_ORANGE, " Be sure to have $30000 in hand to buy rims for your vehicle");
				return 1;
			}
			switch (rims)
			{
				case 1:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1079);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 2:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1073);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 3:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1075);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 4:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1076);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 5:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1077);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 6:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1078);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 7:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1080);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 8:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1083);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 9:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1081);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				case 10:
				{
				    if (GetPlayerCash(playerid) >= 30000)
					{
					    GivePlayerCash(playerid, -30000);
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1082);
						SendClientMessageEx(playerid, COLOR_GRAD1, "Enjoy the new Rims to your vehicle ");
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GRAD1, " You don't have cash to buy this rims");
					}
				}
				default:
				{
					format(string, sizeof(string), "   Invalid rims", rims);
				}
			}
		}
	}
	else
	{
	    SendClientMessage(playerid, COLOR_GRAD1, "You can't use this command!");
	}
	return 1;
}
Reply
#10

Error here : new iPlayer = -1, iVeh; but i changed with iPlayerVeh and now its good i will test it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)