new truck;
truck = AddStaticVehicle(499,2173.2202,-2636.8081,13.5392,158.1144,0,0); //
truck = AddStaticVehicle(499,2180.8071,-2636.3555,13.5342,163.4434,0,0); //
truck = AddStaticVehicle(499,2203.1370,-2633.4329,13.5391,269.3954,0,0); //
truck = AddStaticVehicle(499,2203.8774,-2643.7749,13.5436,267.2371,0,0); //
truck = AddStaticVehicle(499,2246.7744,-2675.3079,13.5442,0.2894,0,0); //
truck = AddStaticVehicle(499,2250.3147,-2675.2898,13.5448,0.2894,0,0); //
truck = AddStaticVehicle(499,2253.5308,-2675.2732,13.5453,0.2894,0,0); //
truck = AddStaticVehicle(499,2258.2942,-2675.2493,13.5461,0.2894,0,0); //
truck = AddStaticVehicle(499,2263.0957,-2675.2251,13.5469,0.2894,0,0); //
truck = AddStaticVehicle(499,2247.6970,-2650.8284,13.5422,92.7948,0,0); //
truck = AddStaticVehicle(499,2247.3877,-2644.5051,13.5842,92.7948,0,0); //
truck = AddStaticVehicle(499,2247.0117,-2636.8062,13.6353,92.7948,0,0); //
truck = AddStaticVehicle(499,2246.6838,-2630.0957,13.6799,92.7948,0,0); //
truck = AddStaticVehicle(499,2210.8445,-2597.9141,13.5346,268.8778,0,0); //
truck = AddStaticVehicle(499,2204.6855,-2569.6677,13.5392,267.5470,0,0); //
public OnPlayerStateChange(playerid, newstate, oldstate) {
if(newstate == 2) {
if(IsATruck(GetPlayerVehicleID(playerid) && pInfo[playerid][pJob] == 1))
{ // if you are in a truck
SendClientMessage(playerid, COLOR_YELLOW, "You've entered an Ocean Dock truck. /loadtruck to load some goods."); // return this message.
} else if(pInfo[playerid][pJob] != 1)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY, "You are not a trucker.");
}
}
return 1;
}
new truck[15];
truck[0] = AddStaticVehicle(499,2173.2202,-2636.8081,13.5392,158.1144,0,0); //
truck[1] = AddStaticVehicle(499,2180.8071,-2636.3555,13.5342,163.4434,0,0); //
truck[2] = AddStaticVehicle(499,2203.1370,-2633.4329,13.5391,269.3954,0,0); //
truck[3] = AddStaticVehicle(499,2203.8774,-2643.7749,13.5436,267.2371,0,0); //
truck[4] = AddStaticVehicle(499,2246.7744,-2675.3079,13.5442,0.2894,0,0); //
truck[5] = AddStaticVehicle(499,2250.3147,-2675.2898,13.5448,0.2894,0,0); //
truck[6] = AddStaticVehicle(499,2253.5308,-2675.2732,13.5453,0.2894,0,0); //
truck[7] = AddStaticVehicle(499,2258.2942,-2675.2493,13.5461,0.2894,0,0); //
truck[8] = AddStaticVehicle(499,2263.0957,-2675.2251,13.5469,0.2894,0,0); //
truck[9] = AddStaticVehicle(499,2247.6970,-2650.8284,13.5422,92.7948,0,0); //
truck[10] = AddStaticVehicle(499,2247.3877,-2644.5051,13.5842,92.7948,0,0); //
truck[11] = AddStaticVehicle(499,2247.0117,-2636.8062,13.6353,92.7948,0,0); //
truck[12] = AddStaticVehicle(499,2246.6838,-2630.0957,13.6799,92.7948,0,0); //
truck[13] = AddStaticVehicle(499,2210.8445,-2597.9141,13.5346,268.8778,0,0); //
truck[14] = AddStaticVehicle(499,2204.6855,-2569.6677,13.5392,267.5470,0,0); //
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == 2)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsATruck(vehicleid) && pInfo[playerid][pJob] == 1 && vehicleid == truck[15])
{
SendClientMessage(playerid, COLOR_YELLOW, "You've entered an Ocean Dock truck. /loadtruck to load some goods."); // return this message.
}
else if(pInfo[playerid][pJob] != 1)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY, "You are not a trucker.");
}
}
return 1;
}
new truck[15]; // [15] as you have 15 trucks
new IsTruck[MAX_VEHICLES]; // a per-vehicle global variable to know whether a vehicle is a truck or not
truck[0] = AddStaticVehicle(499,2173.2202,-2636.8081,13.5392,158.1144,0,0); //
truck[1] = AddStaticVehicle(499,2180.8071,-2636.3555,13.5342,163.4434,0,0); //
truck[2] = AddStaticVehicle(499,2203.1370,-2633.4329,13.5391,269.3954,0,0); //
truck[3] = AddStaticVehicle(499,2203.8774,-2643.7749,13.5436,267.2371,0,0); //
truck[4] = AddStaticVehicle(499,2246.7744,-2675.3079,13.5442,0.2894,0,0); //
truck[5] = AddStaticVehicle(499,2250.3147,-2675.2898,13.5448,0.2894,0,0); //
truck[6] = AddStaticVehicle(499,2253.5308,-2675.2732,13.5453,0.2894,0,0); //
truck[7] = AddStaticVehicle(499,2258.2942,-2675.2493,13.5461,0.2894,0,0); //
truck[8] = AddStaticVehicle(499,2263.0957,-2675.2251,13.5469,0.2894,0,0); //
truck[9] = AddStaticVehicle(499,2247.6970,-2650.8284,13.5422,92.7948,0,0); //
truck[10] = AddStaticVehicle(499,2247.3877,-2644.5051,13.5842,92.7948,0,0); //
truck[11] = AddStaticVehicle(499,2247.0117,-2636.8062,13.6353,92.7948,0,0); //
truck[12] = AddStaticVehicle(499,2246.6838,-2630.0957,13.6799,92.7948,0,0); //
truck[13] = AddStaticVehicle(499,2210.8445,-2597.9141,13.5346,268.8778,0,0); //
truck[14] = AddStaticVehicle(499,2204.6855,-2569.6677,13.5392,267.5470,0,0); //
// then under OnGameModeInit or OnFilterScriptInit if it's a filterscript
for(new i = 0; i < sizeof(truck); i ++) // loops through all the trucks we made
{
IsTruck[i] = 1; // sets them as trucks
}
// a stock to check if a vehicle is truck
stock IsVehicleTruck(vehicleid)
{
if(IsTruck[vehicleid] == 1) // if the vehicleid is a truck here all the trucks we made should be because of the loop we made above
return 1; // return 1 means that's true
// if the above part didn't get executed or wasn't true (Action below)
return 0; // return 0 means that's false
}
if(IsVehicleTruck(vehicleid))
{
// vehicleid is a truck, do something!
}
if(!IsVehicleTruck(vehicleid))
{
// vehicleid is not a truck, do something!
}
Код:
H:\gamemodes\RP.pwn(816) : error 017: undefined symbol "IsTruck" H:\gamemodes\RP.pwn(816) : warning 215: expression has no effect H:\gamemodes\RP.pwn(816) : error 001: expected token: ";", but found "]" H:\gamemodes\RP.pwn(816) : error 029: invalid expression, assumed zero H:\gamemodes\RP.pwn(816) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. pawn Код:
|
It shouldn't give any errors as I compiled it myself before giving you it. Can I ask where are you placing the codes?
|