09.08.2011, 15:16
Morning guys.
I'd like to add a small function to my server's PD regarding their equipment.
Unlike other server, on which you have kinda menu to take guns from (/equip), i want to add a /policetrunk.
What should it do?
a) check if the Player is a PD member (already done by me)
b) check if he is on duty (already done by me)
c) check if a police car is in range
e) open the policecars trunk
( GetVehicleParamsEx(Vehicle[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(Vehicle[playerid], engine, lights, alarm, doors, bonnet, 1, objective); )
f) give player some weapons and maybe armour (can be doen by me with ease)
So, basically i need a loop, which checks what car is the closest one. and if it found one, it should check if its a policecar.
I use arrays to crate them, like those examples.
LSPDCAR [1] = CreateStaticVehicleEx(....)//a patrolcar
LSPDCAR [2] = CreateStaticVehicleEx(....)//a buffalo for fast response team
LSPDCAR [3] = CreateStaticVehicleEx(....)//a undercover vehicle
LSPDCAR [4] = CreateStaticVehicleEx(....)//a enforcer
and then it should return what car it is.
If it is car 1, it should open car 1's trunk and give the officer e.g. a shotgun.
else if its car 2, give him an mp5 and armour.
else if its car 3, give him camera and a silenced pistol.
else if its car 4, give him an m4 and kevlar...
and so on. You could jsu tmake a script with 2 cars, and i could add all the other copcars (i have 23 in total) by myself, if possible with a "else if" -command.
yes i know the identiation sucks here, but i can fix that up later, it always gets kinda lacky when i copy/paste it from pawn to a forum.
I'd like to add a small function to my server's PD regarding their equipment.
Unlike other server, on which you have kinda menu to take guns from (/equip), i want to add a /policetrunk.
What should it do?
a) check if the Player is a PD member (already done by me)
b) check if he is on duty (already done by me)
c) check if a police car is in range
e) open the policecars trunk
( GetVehicleParamsEx(Vehicle[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(Vehicle[playerid], engine, lights, alarm, doors, bonnet, 1, objective); )
f) give player some weapons and maybe armour (can be doen by me with ease)
So, basically i need a loop, which checks what car is the closest one. and if it found one, it should check if its a policecar.
I use arrays to crate them, like those examples.
LSPDCAR [1] = CreateStaticVehicleEx(....)//a patrolcar
LSPDCAR [2] = CreateStaticVehicleEx(....)//a buffalo for fast response team
LSPDCAR [3] = CreateStaticVehicleEx(....)//a undercover vehicle
LSPDCAR [4] = CreateStaticVehicleEx(....)//a enforcer
and then it should return what car it is.
If it is car 1, it should open car 1's trunk and give the officer e.g. a shotgun.
else if its car 2, give him an mp5 and armour.
else if its car 3, give him camera and a silenced pistol.
else if its car 4, give him an m4 and kevlar...
and so on. You could jsu tmake a script with 2 cars, and i could add all the other copcars (i have 23 in total) by myself, if possible with a "else if" -command.
Код:
if(strcmp(cmd, "/policetrunk", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) { if(PlayerInfo[playerid][pDuty] == 1) { //check closest car { //if closest car is LSPDCAR [1] { //give player some stuff&open the cars trunk ill do that by myself later } //else if closest car is LSPDCAR [2] {thesameshitthanabove} //else (if its not a policecar at all) {sendPlayerClientMessage(*randomparameters*,"You are not close to a LSPD Vehicle"); } else { SendClientMessage(playerid, COLOR_GREY, "You are not on Duty."); } } else { SendClientMessage(playerid, COLOR_GREY, "You are not a Member of the LSPD."); } } return 1; }