Right so after coding a bit more a major problem has happend. I decided to make a /Fish command using arrays and enums. But for some unknown reason my compiler crashes. Dunno what the fuck I have done wrong here, maybe you could help?
The second problem is that in my "OnPlayerEntersCheckpoint" the second checkpoint of my Rubbish(Garbage) mission doesn't respond and I can do the Irish Jig in it without it doing fuck all.
pawn Code:
#include <a_samp>
//Stages
enum {
STAGE_NONE,
STAGE_PICKUP,
STAGE_ONROUTE,
STAGE_COMPLETE
}
new MissionStage[MAX_PLAYERS];
//COLORS
#define COLOR_ORANGE 0xFFA500FF
#define COLOR_LIMEGREEN 0x32CD32FF
#define COLOR_ROYALBLUE 0x4169E1FF
#define COLOR_PINK 0xFA8072FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define TEAM_TRUCKER 0
//Garbage CheckPoints
new Float:Gcheckpoints[5][4] =
{
{ 2798.1702,-1576.2926,10.9272, 10.0 },
{ 2060.4375,-2091.2126,13.5469, 10.0 },
{ 070.8125,-2384.6160,13.5469, 10.0 },
{ 900.7358,-1204.0779,16.9832, 10.0 },
{ 800.1103,-1542.8258,13.5526, 10.0 }
};
enum FishEnum{
Fish_Name,
Pay
}
//fish name //fish Price
new Float:Fish[][FishEnum] =
{
{"Cod", "250"},
{"Red Snapper", "250"},
{"Goldfish", "10"},
{"Haydz Fish", "10000"},
{"Tyre", "0"},
{"Baby Shark", "400"},
{"Magikarp", "500"},
{"Gyrados!", "1000"},
{"Pirate Treasure" "2500"},
{"Dead Body" "0"},
{"Nuclear Waste" "0"},
{"Crab" "100"},
{"A Used Condomn" "0"},
{"Dolphin" "300"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"Nothing", "0"},
{"SpongeBob", "1300"}
};
stock IsBoat(carid) //Boat IDs
{
new Boat[] = { 472, 473, 493, 484, 430,
453, 452, 445, 454, 454
};
for(new i = 0; i < sizeof(Boat); i++)
{
if(GetVehicleModel(carid) == Boat[i]) return 1;
}
return 0;
}
main()
{
}
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Life Of Transport");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
//Server Vehicles
CreateVehicle(455, 0, 0, 12.2887, 82.2873, -1, -1, 60);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
//Fishing
if (strcmp("/fish", cmdtext, true, 10) == 0) {
if(GetVehicleMOde(GetPlayerVehicleID(playerid(( == IsBoat[i])
new rand = random(sizeof(Fish));
GameTextForPlayer(playerid, "~b~You Are Fishing. Please Wait...", 3000, 3);
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s is now fishing", name );
format(LoadText, 128, "%s",Fish[MisRand][Pay]);
SendClientMessage(playerid, COLOR_GREEN, "You Have Caught A %s", Fish_Name);
SendClientMessage(playerid, COLOR_BLUE, LoadText);
GivePlayerMoney(playerid, Pay[playerid]);
format(gString, 512, "%s has caught a %s and earnt %s", pName(playerid), Fish_Name[playerid] Pay);
}
else
SendClientMessage(playerid, COLOR_RED, "You Must Be In A Boat To Fish!");
}
return 0;
if (strcmp("/work", cmdtext, true, 10) == 0) {
//Garbage Mission
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 455) {
if (MissionStage[playerid] != STAGE_NONE) {
SendClientMessage(playerid, COLOR_RED, "You are already doing the rubbish truck driving Mission!");
return 1;
}
MissionStage[playerid] = STAGE_PICKUP;
new rand = random(sizeof(Gcheckpoints));
SetPlayerCheckpoint(playerid, Gcheckpoints[rand][0], Gcheckpoints[rand][1], Gcheckpoints[rand][2], Gcheckpoints[rand][3]);
GameTextForPlayer(playerid, "~g~You started the job, good luck!", 3000, 3);
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s is now doing the Rubbish mission.", name );
return SendClientMessageToAll(COLOR_YELLOW, string);
}
return SendClientMessage(playerid, COLOR_RED, "You have to be in a truck to start the job");
//Garbage mission ends
}
return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
DisablePlayerCheckpoint(playerid);
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 455) {
if(STAGE_PICKUP == MissionStage[playerid]) {
SendClientMessage(playerid, COLOR_RED, "Loading Rubbish");
SetPlayerCheckpoint(playerid, 0, 0, 0, 0);
GameTextForPlayer(playerid, "~g~Go drop off the rubbish!", 3000, 3);
MissionStage[playerid] = STAGE_ONROUTE;
}
else if(STAGE_ONROUTE == MissionStage[playerid]) {
DisablePlayerCheckpoint(playerid);
SendClientMessage(playerid, COLOR_RED, "Unloading Rubbish");
GameTextForPlayer(playerid, "~g~You Completed The Mission", 3000, 3);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
GivePlayerMoney(playerid, 5000);
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has Completed A Rubbish Mission!", name );
MissionStage[playerid] = STAGE_NONE;
}
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock pName(PN)
{
new PX[MAX_PLAYER_NAME];
GetPlayerName(PN, PX, sizeof(PX));
return PX;
}
Re: Pawn Help: Compiler Crashes upon Compiling and Checkpoint not responding -
Why is that a float? I'm not even sure if it's actually possible to declare it like this.
Missing lots of brackets here. Not to mention misspelling of function names.
Re: Pawn Help: Compiler Crashes upon Compiling and Checkpoint not responding -
For the fish to random. Guess that wont work.
Re: Pawn Help: Compiler Crashes upon Compiling and Checkpoint not responding -
Fuck it. cant find whats wrong in the code, ill use my previous backup. Thanks for your help anyway.