vehicle help
#1

i scripted my command to stop players from spawn these vehicles

Quote:

CMD:v(playerid, params[])
{
new string[128], vID[32], vid, Float, Float:y, Float:z, Float:ang;
if(PlayerinMMDM[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You are in a DM. Type /kill to exit.");
if(sscanf(params, "s[32]", vID)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /v (carname)");
if(IsSpecing[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You are spectating someone, /specoff or press the jump key first.");
if(GetPlayerState(playerid)==PLAYER_STATE_PASSENGE R) return SendClientMessage(playerid, COLOR_RED, "You can't use this while sitting as a passenger.");
if(isnumeric(vID)) vid = strval(vID);
else vid = GetVehicleModelIDFromName(vID);
if (vid < 400 || vid > 611) return SendClientMessage(playerid, COLOR_RED, "Vehicle ID Maxium (Left): 400 - Maxium (Right): 611");
if(vid == 432 || vid == 520 || vid == 464|| vid == 594|| vid == 441|| vid == 465|| vid == 564 && PlayerAcc[playerid][Admin] <= 2) return SendClientMessage(playerid, COLOR_RED, "sorry, You cant spawn this.");/// these are the vehicles they cant spawn.
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,ang);
if(PlayerVehicle[playerid] != INVALID_VEHICLE_ID) DestroyVehicle(PlayerVehicle[playerid]);
PlayerVehicle[playerid] = CreateVehicle(vid, x, y, z, ang, -1, -1, 6000);
LinkVehicleToInterior(PlayerVehicle[playerid], GetPlayerInterior(playerid));
SetVehicleVirtualWorld(PlayerVehicle[playerid], GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, PlayerVehicle[playerid], 0);
return 1;
}

but i want admins can only spawn them.
Quote:

if(PlayerAcc[playerid][Admin] >= 3)

need help please.
Reply
#2

anyone? or you dont understand me..
Reply
#3

try this one ?
pawn Код:
CMD:v(playerid, params[])
{
if(PlayerAcc[playerid][Admin] >= 3)
new string[128], vID[32], vid, Float, Float:y, Float:z, Float:ang;
if(PlayerinMMDM[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You are in a DM. Type /kill to exit.");
if(sscanf(params, "s[32]", vID)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /v (carname)");
if(IsSpecing[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You are spectating someone, /specoff or press the jump key first.");
if(GetPlayerState(playerid)==PLAYER_STATE_PASSENGE R) return SendClientMessage(playerid, COLOR_RED, "You can't use this while sitting as a passenger.");
if(isnumeric(vID)) vid = strval(vID);
else vid = GetVehicleModelIDFromName(vID);
if (vid < 400 || vid > 611) return SendClientMessage(playerid, COLOR_RED, "Vehicle ID Maxium (Left): 400 - Maxium (Right): 611");
if(vid == 432 || vid == 520 || vid == 464|| vid == 594|| vid == 441|| vid == 465|| vid == 564 && PlayerAcc[playerid][Admin] <= 2) return SendClientMessage(playerid, COLOR_RED, "sorry, You cant spawn this.");/// these are the vehicles they cant spawn.
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,ang);
if(PlayerVehicle[playerid] != INVALID_VEHICLE_ID) DestroyVehicle(PlayerVehicle[playerid]);
PlayerVehicle[playerid] = CreateVehicle(vid, x, y, z, ang, -1, -1, 6000);
LinkVehicleToInterior(PlayerVehicle[playerid], GetPlayerInterior(playerid));
SetVehicleVirtualWorld(PlayerVehicle[playerid], GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, PlayerVehicle[playerid], 0);
return 1;
}
Reply
#4

try this

CMD:v(playerid, params[])
{

if(PlayerAcc[playerid][Admin] >= 3)
return 0;

new string[128], vID[32], vid, Float, Float:y, Float:z, Float:ang;
if(PlayerinMMDM[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You are in a DM. Type /kill to exit.");
if(sscanf(params, "s[32]", vID)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /v (carname)");
if(IsSpecing[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You are spectating someone, /specoff or press the jump key first.");
if(GetPlayerState(playerid)==PLAYER_STATE_PASSENGE R) return SendClientMessage(playerid, COLOR_RED, "You can't use this while sitting as a passenger.");
if(isnumeric(vID)) vid = strval(vID);
else vid = GetVehicleModelIDFromName(vID);
if (vid < 400 || vid > 611) return SendClientMessage(playerid, COLOR_RED, "Vehicle ID Maxium (Left): 400 - Maxium (Right): 611");
if(vid == 432 || vid == 520 || vid == 464|| vid == 594|| vid == 441|| vid == 465|| vid == 564 && PlayerAcc[playerid][Admin] <= 2) return SendClientMessage(playerid, COLOR_RED, "sorry, You cant spawn this.");/// these are the vehicles they cant spawn.
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,ang);
if(PlayerVehicle[playerid] != INVALID_VEHICLE_ID) DestroyVehicle(PlayerVehicle[playerid]);
PlayerVehicle[playerid] = CreateVehicle(vid, x, y, z, ang, -1, -1, 6000);
LinkVehicleToInterior(PlayerVehicle[playerid], GetPlayerInterior(playerid));
SetVehicleVirtualWorld(PlayerVehicle[playerid], GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, PlayerVehicle[playerid], 0);
return 1;
}
Reply
#5

Didn't understand well, but try this :

PHP код:
CMD:v(playeridparams[])
{
new 
string[128], vID[32], vidFloatFloat:yFloat:zFloat:ang;
if(
PlayerinMMDM[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You are in a DM. Type /kill to exit.");
if(
sscanf(params"s[32]"vID)) return SendClientMessage(playeridCOLOR_RED"Syntax: /v (carname)");
if(
IsSpecing[playerid] == 1) return SendClientMessage(playeridCOLOR_RED,"You are spectating someone, /specoff or press the jump key first.");
if(
GetPlayerState(playerid)==PLAYER_STATE_PASSENGE R) return SendClientMessage(playeridCOLOR_RED"You can't use this while sitting as a passenger.");
if(
isnumeric(vID)) vid strval(vID);
else 
vid GetVehicleModelIDFromName(vID);
if (
vid 400 || vid 611) return SendClientMessage(playeridCOLOR_RED"Vehicle ID Maxium (Left): 400 - Maxium (Right): 611");
if(
vid == 432 || vid == 520 || vid == 464|| vid == 594|| vid == 441|| vid == 465|| vid == 564 && PlayerAcc[playerid][Admin] <= 2) return SendClientMessage(playeridCOLOR_RED"sorry, You cant spawn this.");/// these are the vehicles they cant spawn.
if(PlayerAcc[playerid][Admin] >= 3)
{
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,ang);
if(
PlayerVehicle[playerid] != INVALID_VEHICLE_IDDestroyVehicle(PlayerVehicle[playerid]);
PlayerVehicle[playerid] = CreateVehicle(vidxyzang, -1, -16000);
LinkVehicleToInterior(PlayerVehicle[playerid], GetPlayerInterior(playerid));
SetVehicleVirtualWorld(PlayerVehicle[playerid], GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playeridPlayerVehicle[playerid], 0);
}
return 
1;

Reply
#6

the command /v is for everyone to use. i dont want players who are under the level: 2 to spawn vehicles like hydra, rhino and etc like that.
Reply
#7

Remove <= 2 and make it to < 2.
Reply
#8

i did that and it still stoping me from spawning those while im higher that lvl 2
Reply
#9

any help?
Reply
#10

Change it to if(PlayerAcc[playerid][Admin] >= 2) now for all 2ns lvl and above can use..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)