SA-MP Forums Archive
Something wrong with my mission script. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Something wrong with my mission script. (/showthread.php?tid=313033)



Something wrong with my mission script. - Rokzlive - 24.01.2012

Im developing a mission script for my server, and i cant even compile the darn thing because it crashes.

Heres the script (yes i stole sample mission from the truckign mission include)
pawn Код:
#include <a_samp>

enum PlayerMissionInfo
{
    Pay,
    Checkpoint,
    OnCheckpoint,
    Float:UnloadPos[3],
    TrailerVehId,
    VehicleId
}
new PlayerMissionData[MAX_PLAYERS][PlayerMissionInfo];

enum MissionInfo
{
    Info[200],
    Pay,
    Type,
    Float:LoadPos[3],
    Float:UnloadPos[3]
}
new MissionData[][MissionInfo] =
{
    {"Deliver Holy Water from LVA Freight to LVA Church", 1, 1701.9475, 940.5465, 10.8203, 1496.2524, 772.1427, 10.8203},
    {"Deliver Junk Car Parts from LVA Freight Depot to Shody Ottos", 1701.9475, 940.5465, 10.8203, 1727.6351, 1812.1750, 10.8203}
};

new Working[MAX_PLAYERS], String[500];

Stock StartWorking(playerid)
{
    if (Working[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA, "Your already on a route, so we cannot give you a new one!");
    new ID = random(sizeof(MissionData));
    new VehModel = GetVehicleModel(GetPlayerVehicleID(playerid));
    if(VehModel == 403 || VehModel == 514 || VehModel == 515)
    {
        if(MissionData[ID][Type] != 1) return StartWorking(playerid);
    }
    Working[playerid] = 1;
    PlayerMissionData[playerid][Pay] = MissionData[ID][Pay];
    return 1;
}
What about this is fucking up my pawno?

Like i said, its being developed, no where near done.


Re: Something wrong with my mission script. - MP2 - 24.01.2012

Try commenting out parts of it until it's fixed. When it fixes, you know the last thing you commented out was causing the problem.


Re: Something wrong with my mission script. - Chris White - 24.01.2012

well, idk, but I think that you have to use the define MAX_PLAYERS in the new MissionData[][MissionInfo]
A second thing is: how do you assign a value to the whole enum? I've never seen it before. Maybe that's your error, so try to fix it out.


Re: Something wrong with my mission script. - [HK]Ryder[AN] - 24.01.2012

Edit - this was not the problem


Re: Something wrong with my mission script. - Chris White - 24.01.2012

Can't you see that he didn't assign a length to the array in new MissionData[][MissionInfo] ?


Re: Something wrong with my mission script. - Haydz - 24.01.2012

You've got a capital letter at the start of 'stock'

pawn Код:
Stock StartWorking(playerid) //change the uppercase S to a lowercase.
{
    if (Working[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA, "Your already on a route, so we cannot give you a new one!");
    new ID = random(sizeof(MissionData));
    new VehModel = GetVehicleModel(GetPlayerVehicleID(playerid));
    if(VehModel == 403 || VehModel == 514 || VehModel == 515)
    {
        if(MissionData[ID][Type] != 1) return StartWorking(playerid);
    }
    Working[playerid] = 1;
    PlayerMissionData[playerid][Pay] = MissionData[ID][Pay];
    return 1;
}
Yes, I tried placing an uppercase letter at the start of Stock in my script and it also crashed me. So it should solve your problem (hopefully).


Re: Something wrong with my mission script. - [HK]Ryder[AN] - 24.01.2012

Quote:
Originally Posted by Haydz
Посмотреть сообщение
You've got a capital letter at the start of 'stock'

pawn Код:
Stock StartWorking(playerid) //change the uppercase S to a lowercase.
{
    if (Working[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA, "Your already on a route, so we cannot give you a new one!");
    new ID = random(sizeof(MissionData));
    new VehModel = GetVehicleModel(GetPlayerVehicleID(playerid));
    if(VehModel == 403 || VehModel == 514 || VehModel == 515)
    {
        if(MissionData[ID][Type] != 1) return StartWorking(playerid);
    }
    Working[playerid] = 1;
    PlayerMissionData[playerid][Pay] = MissionData[ID][Pay];
    return 1;
}
Yes, I tried placing an uppercase letter at the start of Stock in my script and it also crashed me. So it should solve your problem.
oh yeah I forgot.Hey man remember pawn is case sensitive.this is your problem.


Re: Something wrong with my mission script. - Chris White - 24.01.2012

So what I said is wrong? I just wanna know if I was right.


Re: Something wrong with my mission script. - MP2 - 24.01.2012

Quote:
Originally Posted by Haydz
Посмотреть сообщение
You've got a capital letter at the start of 'stock'

pawn Код:
Stock StartWorking(playerid) //change the uppercase S to a lowercase.
{
    if (Working[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA, "Your already on a route, so we cannot give you a new one!");
    new ID = random(sizeof(MissionData));
    new VehModel = GetVehicleModel(GetPlayerVehicleID(playerid));
    if(VehModel == 403 || VehModel == 514 || VehModel == 515)
    {
        if(MissionData[ID][Type] != 1) return StartWorking(playerid);
    }
    Working[playerid] = 1;
    PlayerMissionData[playerid][Pay] = MissionData[ID][Pay];
    return 1;
}
Yes, I tried placing an uppercase letter at the start of Stock in my script and it also crashed me. So it should solve your problem (hopefully).
/endtopic?


Re: Something wrong with my mission script. - Rokzlive - 24.01.2012

Thanks a million haydz, +1