Compiled 100% success and Server is crashing when using this command! -
silvan - 12.04.2009
hi guys i made this /unsuspect command which i can find nothing wrong in it but server keep crashing i dunno why.
Код:
if(strcmp(cmd,"/unsuspect",true) == 0 || PlayerInfo[playerid][team] == TEAM_POLICE)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /unsuspect [playerid]");
return 1;
}
for (new i = 0; i <MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerInfo[i][team] == TEAM_POLICE)
{
format(string,sizeof(string), "Officer %s Unsuspected %s");
SendClientMessage(playerid, COLOR_BLUEPOLICE, string);
}
}
giveplayerid = strval(tmp);
PlayerInfo[giveplayerid][suspected] = 0;
SavePlayer(giveplayerid);
return 1;
}
Re: Compiled 100% success and Server is crashing when using this command! -
Kinetic - 12.04.2009
try using the utils.inc and instead of giveplayer=strval(tmp); do giveplayer=ReturnUser(tmp);
Re: Compiled 100% success and Server is crashing when using this command! -
silvan - 12.04.2009
i tried that but server still crash
Re: Compiled 100% success and Server is crashing when using this command! -
silvan - 12.04.2009
any help? plsssss
Re: Compiled 100% success and Server is crashing when using this command! -
Rac3r - 12.04.2009
Код:
if(strcmp(cmd,"/unsuspect",true) == 0 || PlayerInfo[playerid][team] == TEAM_POLICE)
Shouldn't this be :
Код:
if(strcmp(cmd,"/unsuspect",true) == 0 && PlayerInfo[playerid][team] == TEAM_POLICE)
Try this, quick throw up of code.
http://pastebin.com/m750e99d8
Re: Compiled 100% success and Server is crashing when using this command! -
silvan - 12.04.2009
lol i just tghout of that. tnx for help bro

anyways. it was just under my nose and i didn't seen it lolz
that was a bug which i didn't saw but server is still crashing after i made that.
i also tried the command you made me in pastebin but still server is crashing... also the function of " SavePlayer " is this... maybe its something wrong in it..
Код:
stock SavePlayer(playerid)
{
new fname[256],playername[256],filestring[256];
new File: file;
GetPlayerName(playerid, playername, sizeof(playername));
format(fname,sizeof(fname),P_FILE,udb_encode(playername));
if(!fexist(fname)) {}
else {
file = fopen(fname, io_write);
if(file) {
PlayerInfo[playerid][pcash] = GetPlayerMoney(playerid);
format(filestring,sizeof(filestring),"%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%s",playername,PlayerInfo[playerid][vowned],PlayerInfo[playerid][vowner],PlayerInfo[playerid][pass],PlayerInfo[playerid][pcash],PlayerInfo[playerid][bank],PlayerInfo[playerid][admin],PlayerInfo[playerid][bowner],PlayerInfo[playerid][bowned],PlayerInfo[playerid][sjob],PlayerInfo[playerid][suspected],PlayerInfo[playerid][suspectreason]);
fwrite(file,filestring);
fclose(file);
}
}
return 1;
}