24.03.2013, 12:02
Hey there, I'm having this problem with some scripting. I'm trying to get a random number (either 0 or 1), and I just get an error that says Random is not defined.
Here are my includes:
Here is my code:
Here is the error I get:
I really don't understand the problem. The wiki has the random function on there, so it should work, right? But anyway, I have no idea. Any help will be appreciated.
Thanks, Matty
E: Oh, and another thing; how do I put these code blocks into PAWN syntax? Do I use BB codes?
Here are my includes:
Код:
#include <a_samp> #include <a_players> #include <dini> #include <dudb> #include <dutils> #pragma unused ret_memcpy #include <foreach> #include <sscanf2> #include <zcmd> #include <streamer> #include <OPSP> #include <progress> #include <gvc>
Код:
CMD:hotwire(playerid, params[]) { new string[128], Float:playerHealth; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); new playerstate = GetPlayerState(playerid), vehmodel = GetVehicleModel(GetPlayerVehicleID(playerid)), vehid = GetPlayerVehicleID(playerid), rnd = Random(1); if(vehmodel == 481 || vehmodel == 509 || vehmodel == 510) return SendClientMessage(playerid, COLOR_GREY, "You can't hotwire a bicycle."); if(playerstate != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle"); new engine, lights, alarm, doors, bonnet, boot, objective; GetVehicleParamsEx(vehid, engine, lights, alarm, doors, bonnet, boot, objective); if(engine) return SendClientMessage(playerid, COLOR_GREY, "The vehicle's engine is already on."); if(rnd == 0) { format(string, sizeof(string), "* %s has tried to hotwire the vehicle's engine, but got shocked."); GetPlayerHealth(playerid, playerHealth); SetPlayerHealth(playerid, playerHealth - 15); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); } if(rnd == 1) { format(string, sizeof(string), "* %s has tried to hotwire the vehicle, and the engine started."); SetVehicleParamsEx(vehid, 1, lights, 1, doors, bonnet, boot, objective); SetTimerEx("AlarmOff", 7500, 0, "i", vehid); } return 1; }
Код:
error 017: undefined symbol "Random"
Thanks, Matty
E: Oh, and another thing; how do I put these code blocks into PAWN syntax? Do I use BB codes?