cmd:beginevent(playerid, params[]) { new rand = Random(1, 99); if(EventCars[rand] == INVALID_VEHICLE_ID) { new Float:x, Float:y, Float:z; new Float:Angle; GetPlayerFacingAngle(i, Angle); GetPlayerPos(i, x, y, z); EventCars[rand] = CreateVehicle(Events[EventCar], x,y,z+2,Angle,-1,-1,VEHICLE_RESPAWN); VehicleFuel[EventCars[rand]] = 100.0; Vehicle_ResetData(EventCars[rand]); PutPlayerInVehicle(i, EventCars[rand], 0); SetPlayerHealth(i, Events[Health]); SetPlayerArmor(i, Events[Armor]); CarShooting[i] = 1; } } new EventCars[100] = INVALID_VEHICLE_ID;
You didn't return a value
Do it by typing "return 1;" end of the if, and another "return 1;" at the end of the CMD Tell me what's happen after you do this. |
if(EventCars[rand] == INVALID_VEHICLE_ID) { new Float:x, Float:y, Float:z; new Float:Angle; GetPlayerFacingAngle(i, Angle); GetPlayerPos(i, x, y, z); EventCars[rand] = CreateVehicle(Events[EventCar], x,y,z+2,Angle,-1,-1,VEHICLE_RESPAWN); VehicleFuel[EventCars[rand]] = 100.0; Vehicle_ResetData(EventCars[rand]); PutPlayerInVehicle(i, EventCars[rand], 0); SetPlayerHealth(i, Events[Health]); SetPlayerArmor(i, Events[Armor]); CarShooting[i] = 1; return 1; }
CMD:beginevent(playerid, params[])
{
new rand = Random(1, 99);
if(EventCars[rand] == INVALID_VEHICLE_ID)
{
new Float:x, Float:y, Float:z;
new Float:Angle;
GetPlayerFacingAngle(i, Angle);
GetPlayerPos(i, x, y, z);
EventCars[rand] = CreateVehicle(Events[EventCar], x,y,z+2,Angle,-1,-1,VEHICLE_RESPAWN);
VehicleFuel[EventCars[rand]] = 100.0;
Vehicle_ResetData(EventCars[rand]);
PutPlayerInVehicle(i, EventCars[rand], 0);
SetPlayerHealth(i, Events[Health]);
SetPlayerArmor(i, Events[Armor]);
CarShooting[i] = 1;
return 1;
}
return 1;
}
You didn't return a value
Do it by typing "return 1;" end of the if, and another "return 1;" at the end of the CMD Tell me what's happen after you do this. |
new EventCars[100] = INVALID_VEHICLE_ID;
new EventCars[100] = {INVALID_VEHICLE_ID, ...};
Declaring as:
pawn Код:
pawn Код:
|
new EventCars[100] = {INVALID_VEHICLE_ID, ...};