SA-MP Forums Archive
Cell spawn not working. - 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: Cell spawn not working. (/showthread.php?tid=390356)



Cell spawn not working. - stix - 05.11.2012

pawn Код:
if(Cell[playerid] == 1 && countn[playerid] >= 1 && FPrison[playerid] == 1)
    {
    SetPlayerInterior(playerid, 20);
    SetPlayerPos(playerid, 1799.6770,-1552.7550,5700.4287);
    SetPlayerFacingAngle(playerid, 269.2757);
    new message[128];
    SendClientMessage(playerid, GRAY, "You still have time to serve in prison.");
    format(message, sizeof(message), "You will be released in %d minutes.", countn[playerid]);
    SendClientMessage(playerid, GRAY, message);
    ResetPlayerWeapons(playerid);
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 0);
    timer[playerid]=SetTimerEx("Unjailed",countn[playerid]*60000,false,"i",playerid);
    return 1;
    }
I set this onplayerspawn, so when the player logs in and he's jailed he goes back to his cell and sets his time to when he logged out.

Thing is, player can spawn normally even if he's jailed at his spawn ongamemodeinit, i'll give you the information so you can check the problem.

pawn Код:
new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"PlayerData");
    INI_WriteInt(File,"LSPDRank",PlayerData[playerid][LSPDRank]);
    INI_WriteInt(File,"FBIRank",PlayerData[playerid][FBIRank]);
    INI_WriteInt(File,"Cells",Cell[playerid]);
    INI_WriteInt(File,"FPrison",FPrison[playerid]);
    INI_WriteInt(File,"Jailed",Jailed[playerid]);
    INI_WriteInt(File,"Jailed2",Jailed2[playerid]);
    INI_WriteInt(File,"FBIJailed",FBIJailed[playerid]);
    INI_WriteInt(File,"FBIJailed2",FBIJailed2[playerid]);
    INI_WriteInt(File,"Wanted",PlayerData[playerid][Wanted]);
    INI_Close(File);

pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_String("Password",PlayerData[playerid][Pass], 129);
    INI_Int("LSPDRank",PlayerData[playerid][LSPDRank]);
    INI_Int("FBIRank",PlayerData[playerid][FBIRank]);
    INI_Int("Cells",Cell[playerid]);
    INI_Int("FPrison",FPrison[playerid]);
    INI_Int("Jailed",Jailed[playerid]);
    INI_Int("Jailed2",Jailed2[playerid]);
    INI_Int("FBIJailed",FBIJailed[playerid]);
    INI_Int("FBIJailed2",FBIJailed2[playerid]);
    INI_Int("Wanted",PlayerData[playerid][Wanted]);
    return 1;
}
Other things as FBI and LSPDRank load up correctly, but cells and FPrison values are ignored.


Re: Cell spawn not working. - Stu1 - 05.11.2012

Can you show your enum?


Respuesta: Cell spawn not working. - stix - 05.11.2012

pawn Код:
enum Info
{
    OWNER,
    Pass[129],
    pCash,
    Scores,
    LAERank,
    LSPDRank,
    FBIRank,
    Duty,
    Cuffs,
    Radio,
    Badge,
    Frequency,
    Wanted,
    Money,
}

new PlayerData[MAX_PLAYERS][Info];



Re: Cell spawn not working. - Stu1 - 05.11.2012

Add your jailed defines to enum and make it so its saving PlayerInfo[playerid[Jailed] etc


Respuesta: Cell spawn not working. - stix - 05.11.2012

Y_Ini doesnt works with MAX PLAYERS created defines ?


Respuesta: Cell spawn not working. - stix - 06.11.2012

bump changed to playerdata

didnt work


Re: Cell spawn not working. - Smally - 06.11.2012

pawn Код:
if(Cell(playerid) == 1 && countn(playerid) >= 1 && FPrison(playerid) == 1) //Pretty sure it needs to be ( not ]
    {
    SetPlayerInterior(playerid, 20);
    SetPlayerPos(playerid, 1799.6770,-1552.7550,5700.4287);
    SetPlayerFacingAngle(playerid, 269.2757);
    new message[128];
    SendClientMessage(playerid, GRAY, "You still have time to serve in prison.");
    format(message, sizeof(message), "You will be released in %d minutes.", countn[playerid]);
    SendClientMessage(playerid, GRAY, message);
    ResetPlayerWeapons(playerid);
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 0);
    timer[playerid]=SetTimerEx("Unjailed",countn[playerid]*60000,false,"i",playerid);
    return 1;
    }



Respuesta: Cell spawn not working. - stix - 06.11.2012

do i have to change all the [] for () or only at the if cases ?


Re: Cell spawn not working. - Smally - 06.11.2012

That should do it I think.


Respuesta: Cell spawn not working. - stix - 06.11.2012

i did it and still didnt work lol