25.11.2017, 10:22
Hello.
Im stuck on something.
I have some kind of script for organization vehicle's. Now i want to set a restriction for certain commands. so that they can only be used in organization vehicles.
What i tried:
If(vehicleid != Organization[orgid][VehiclesCreated]) return SendClientMessage(playerid, COLOR_RED, "You are not driving a organization vehicle!");
What am i doing wrong? How to make it work.
This is how a organization vehicle is created:
Edit:
I now have this. But when i'm in a organization vehicle it says im not driving a organization vehicle.
Im stuck on something.
I have some kind of script for organization vehicle's. Now i want to set a restriction for certain commands. so that they can only be used in organization vehicles.
What i tried:
If(vehicleid != Organization[orgid][VehiclesCreated]) return SendClientMessage(playerid, COLOR_RED, "You are not driving a organization vehicle!");
Код:
CMD:m1(playerid,params[]) { if(IsJailedOrMuted(playerid))return 1; if(PlayerOrgType(playerid)==LAW) { new vehicleid=GetPlayerVehicleID(playerid),str[128]; If(vehicleid != Organization[orgid][VehiclesCreated]) return SendClientMessage(playerid, COLOR_RED, "You are not driving a organization vehicle!"); { format(str,sizeof(str),"Megaphone: THIS IS THE POLICE, PULL OVER TO THE SIDE OF THE ROAD!!!"); } SendNearbyMessage(playerid,150.0,str,BLUE); }else return SendClientMessage(playerid,GREY,"You are not a police officer"); return 1; }
This is how a organization vehicle is created:
Код:
CreateOrgVehicle("San Andreas Police Dept",596,1600.3672,-1704.1592,5.6134,89.9169,53,1); stock CreateOrgVehicle(org[40],model,Float:x,Float:y,Float:z,Float:rot,clr1,clr2) { if (!DoesOrgExist(org)) return printf("You are attempting to create org. vehicles for an org. which does not exist"); new orgid=GetOrgID(org); new freeslot=Organization[orgid][VehiclesCreated]; if (freeslot >=MAX_ORG_VEHICLES) return printf("ERROR: %s cannot handle more vehicles! Aborted",org); Organization[orgid][Vehicles][freeslot]=CreateVehicle(model,x,y,z,rot,clr1,clr2,900); Organization[orgid][VehiclesCreated]++; new string[10]; format(string,10,"Org (%d)",orgid); SetVehicleNumberPlate(Organization[orgid][Vehicles][freeslot],string); return 1; }
I now have this. But when i'm in a organization vehicle it says im not driving a organization vehicle.
Код:
//============================================================================== CMD:m1(playerid,params[]) { if(IsJailedOrMuted(playerid))return 1; if(PlayerOrgType(playerid)==LAW) { new orgid=PlayerOrg[playerid]; new vehicleid=GetPlayerVehicleID(playerid),str[128]; if(vehicleid != Organization[orgid][VehiclesCreated]) return SendClientMessage(playerid, COLOR_RED, "You are not driving a organization vehicle!"); { format(str,sizeof(str),"Megaphone: THIS IS THE POLICE, PULL OVER TO THE SIDE OF THE ROAD!!!"); } SendNearbyMessage(playerid,150.0,str,BLUE); }else return SendClientMessage(playerid,GREY,"You are not a police officer"); return 1; }