20.06.2016, 09:57
hello there i want to make a temp vip for my server but i got a problem the stats wont saved when player disconnect
Crashdetect ERROR
here my command script
this is onplayerdisconnect script
i dont know whats wrong in my script pls help
Crashdetect ERROR
pawn Code:
[debug] Run time error 6: "Invalid instruction"
[17:47:31] [debug] Unknown opcode 0x2c66eb8 at address 0x00000038
[17:47:31] [debug] AMX backtrace:
[17:47:31] [debug] #0 00000038 in public SAT_OnPlayerDisconnect () from v2_VIPBackup.amx
[17:47:31] [debug] #1 native CallLocalFunction () from samp-server.exe
[17:47:31] [debug] #2 0001f284 in public Streamer_OnPlayerDisconnect (0, 1) from v2_VIPBackup.amx
[17:47:31] [debug] #3 native CallLocalFunction () from samp-server.exe
[17:47:31] [debug] #4 00017264 in public Itter_OnPlayerDisconnect (0, 1) from v2_VIPBackup.amx
[17:47:31] [debug] #5 000166d8 in public SSCANF_OnPlayerDisconnect (0, 1) from v2_VIPBackup.amx
[17:47:31] [debug] #6 00010270 in ?? (0, 1) from v2_VIPBackup.amx
[17:47:31] [debug] #7 000059f8 in public OnPlayerDisconnect (0, 1) from v2_VIPBackup.amx
pawn Code:
COMMAND:settempvip(playerid, params[])
{
if(pInfo[playerid][Adminlevel] <= 5) return SendClientMessage(playerid, -1, ""COL_BLUE"AdmCmd: You don't have the privilege to use this command.");
new
string[1000],pplayerid,level,day,date[6],ts_unvip = gettime() + (day * 86400);
if(sscanf(params, "uii", pplayerid, level, day)) return SCM(playerid, COLOR_RED, ""COL_CYAN"Info: "COL_WHITE"/Setvip (Playerid) (Viplevel) (Day)");
if(pplayerid == IPI) return SCM(playerid, -1, ""COL_RED"Error: "COL_WHITE"Wrong Playerid.");
if(level > 3 || level < 0) return SCM(playerid, COLOR_RED, ""COL_RED"Error: "COL_WHITE"Wrong Level Id.");
pInfo[pplayerid][VIPlevel] = level;
pInfo[pplayerid][waktu] = ts_unvip;
//DateToTimestamp();
TimestampToDate(ts_unvip,date[0],date[1],date[2],date[3],date[4],date[5],0);
format(string,sizeof(string),"- Your VIP Valid Until: %02d/%02d/%02d %02d:%02d:%02d (%d day(s))",date[2],date[1],date[0],date[3],date[4],date[5],day);
SendClientMessage(pplayerid,-1,string);
format(string,sizeof(string),""COL_BLUE"AdmCmd: Administrator \"%s (%d)\" has set your VIP level to ( Level: %d ).",GetName(playerid),playerid,level);
SCM(pplayerid,-1,string);
format(string,sizeof(string),""COL_BLUE"AdmCmd: You have set player \"%s (%d)\" VIP level to (Level: %d).",GetName(pplayerid),pplayerid,level);
SCM(playerid,-1,string);
return 1;
}
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
if(Team[playerid]==ASIA)
{ teamplayers[ASIA]--; }
else if(Team[playerid]==AFRICA)
{ teamplayers[AFRICA]--; }
else if(Team[playerid]==AMERICA)
{ teamplayers[AMERICA]--; }
else if(Team[playerid]==EUROPE)
{ teamplayers[EUROPE]--; }
else if(Team[playerid]==AUSTRALIA)
{ teamplayers[AUSTRALIA]--; }
else if(Team[playerid]==MERCENARY)
{ teamplayers[MERCENARY]--; }
if(fexist(Path(playerid)))
{
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
INI_WriteInt(file,"Time-Seconds",pInfo[playerid][Seconds]);
INI_WriteInt(file,"Time-Minutes",pInfo[playerid][Minutes]);
INI_WriteInt(file,"Time-Hours",pInfo[playerid][Hours]);
INI_WriteInt(file,"Banned",pInfo[playerid][Banned]);
INI_WriteInt(file,"waktu",pInfo[playerid][waktu]);
INI_WriteInt(file,"Warlord-I",pInfo[playerid][Warlord1]);
INI_WriteInt(file,"Warlord-II",pInfo[playerid][Warlord2]);
INI_WriteInt(file,"Warlord-III",pInfo[playerid][Warlord3]);
INI_Close(file);
}
new pFile[35];
format(pFile, 35, Player_File, GetName(playerid));
new
INI:UserFile = INI_Open(pFile);
INI_WriteInt(UserFile, "Admin", P_Data[playerid][pAdmin]);
INI_WriteInt(UserFile, "Money", GetPlayerMoney(playerid));
INI_WriteInt(UserFile, "Score", GetPlayerScore(playerid));
INI_WriteInt(UserFile, "Skin", P_Data[playerid][pSkin]);
INI_WriteInt(UserFile, "Warn", P_Data[playerid][pWarn]);
INI_Close(UserFile);
if(fexist(Path_2(playerid)))
{
new INI:file = INI_Open(Path_2(playerid));
INI_SetTag(file,"Player Car-Saver Data");
INI_WriteFloat(file,"(1)Postion-PosX",PositionSaver[playerid][PosX1]);
INI_WriteFloat(file,"(1)Postion-PosY",PositionSaver[playerid][PosY1]);
INI_WriteFloat(file,"(1)Postion-PosZ",PositionSaver[playerid][PosZ1]);
INI_WriteInt(file,"(1)Interior",PositionSaver[playerid][Interior1]);
INI_WriteFloat(file,"(2)Postion-PosX",PositionSaver[playerid][PosX2]);
INI_WriteFloat(file,"(2)Postion-PosY",PositionSaver[playerid][PosY2]);
INI_WriteFloat(file,"(2)Postion-PosZ",PositionSaver[playerid][PosZ2]);
INI_WriteInt(file,"(2)Interior",PositionSaver[playerid][Interior2]);
INI_WriteFloat(file,"(3)Postion-PosX",PositionSaver[playerid][PosX3]);
INI_WriteFloat(file,"(3)Postion-PosY",PositionSaver[playerid][PosY3]);
INI_WriteFloat(file,"(3)Postion-PosZ",PositionSaver[playerid][PosZ3]);
INI_WriteInt(file,"(3)Interior",PositionSaver[playerid][Interior3]);
INI_WriteFloat(file,"(4)Postion-PosX",PositionSaver[playerid][PosX4]);
INI_WriteFloat(file,"(4)Postion-PosY",PositionSaver[playerid][PosY4]);
INI_WriteFloat(file,"(4)Postion-PosZ",PositionSaver[playerid][PosZ4]);
INI_WriteInt(file,"(4)Interior",PositionSaver[playerid][Interior4]);
INI_WriteFloat(file,"(5)Postion-PosX",PositionSaver[playerid][PosX5]);
INI_WriteFloat(file,"(5)Postion-PosY",PositionSaver[playerid][PosY5]);
INI_WriteFloat(file,"(5)Postion-PosZ",PositionSaver[playerid][PosZ5]);
INI_WriteInt(file,"(5)Interior",PositionSaver[playerid][Interior5]);
INI_Close(file);
}
KillTimer(gAirdropTimer[playerid]);
RemovePlayerAttachedObject(playerid, 0);
DestroyDynamicCP(cekpoint[playerid][ASIA]);
DestroyDynamicCP(cekpoint[playerid][AFRICA]);
DestroyDynamicCP(cekpoint[playerid][AMERICA]);
DestroyDynamicCP(cekpoint[playerid][EUROPE]);
DestroyDynamicCP(cekpoint[playerid][AUSTRALIA]);
return 1;
}