For-Loop Break;(Report Crash) -
Bloodangel - 10.09.2011
Hello,
this is my first post in this Forum.
If my english is bad its not my Mistake it is even the mistake of my keyboard.
If got a problem with my helpdesk.
If i join there are no mistakes all is updating very well. But if i go zo a house(haus in the script)
i become a report crash. If got no Error or Warnings. I must Stop the Loop cause else it show always other houses and not this what i want to. If you got questions about the language its german normaly i ask there if i've got questions but there nobody is answering. Now here the Code:
Pawno Code:
Код:
public HelpdeskUp(playerid)
{
new hour,minute,second;
new hdesk[500];
gettime(hour,minute,second);
new day,month,year;
getdate(year,month,day);
new plname[MAX_PLAYER_NAME],astring[50];
GetPlayerName(playerid, plname, sizeof(plname));
if(pInfo[playerid][admin] == 0){ format(astring,80,"Normal"); }
if(pInfo[playerid][admin] == 1) { format(astring,80,"Supporter"); }
else if(pInfo[playerid][admin] == 2) { format(astring,80,"Moderator"); }
else if(pInfo[playerid][admin] == 3) { format(astring,80,"Suprt Moderator"); }
else if(pInfo[playerid][admin] == 4) { format(astring,80,"Administrator"); }
else if(pInfo[playerid][admin] == 5) { format(astring,80,"Serverletiung"); }
for(new haus=1;haus<MAX_HAUS;haus++)
{
if(!IsPlayerInRangeOfPoint(playerid,2,HausInfo[haus][haus_x],HausInfo[haus][haus_y],HausInfo[haus][haus_z]))
{
format(hdesk,sizeof(hdesk)," ~w~.::Hilfeleiste::.~n~~n~~w~Rang:~r~%s~n~~w~Uhrzeit: ~g~%d:%d %d ~n~~w~Datum: ~g~%d.%d.%d~n~~w~Dein Nickname: ~g~%s~n~~w~Dein ID:%d~n~~w~Kontostand: ~y~%d$ ~n~~w~Hunger/Durst: ~g~%d~n~~w~Energie: ~g~%d~n~~w~Harndrang: ~g~%d",astring,hour,minute,second,day,month,year,plname,playerid,pInfo[playerid][pBank],pInfo[playerid][hunger],pInfo[playerid][energie],pInfo[playerid][harndrang]);
TextDrawSetString(Helpdesk, hdesk);
}
else if(IsPlayerInRangeOfPoint(playerid,5,HausInfo[haus][haus_x],HausInfo[haus][haus_y],HausInfo[haus][haus_z]))
{
format(hdesk,sizeof(hdesk)," ~w~.::Hilfeleiste::.~n~~n~~w~Rang:~r~%s~n~~w~Uhrzeit: ~g~%d:%d %d ~n~~w~Datum: ~g~%d.%d.%d~n~~w~Dein Nickname: ~g~%s~n~~w~Dein ID:%d~n~~w~Kontostand: ~y~%d$ ~n~~w~Hunger/Durst: ~g~%d~n~~w~Energie: ~g~%d~n~~w~Harndrang: ~g~%d~n~~n~~w~.::Hausinfo::..~n~~n~~w~Besitzer: %s ~n~Preis: %d$~n~Miete: %d$~n~Mieter 1: %s~n~Mieter 2: %s~n~Mieter 3: %s~n~Mieter 4: %s~n~Mieter 5: %s",
astring,hour,minute,second,day,month,year,plname,playerid,pInfo[playerid][pBank],pInfo[playerid][hunger],pInfo[playerid][energie],pInfo[playerid][harndrang],HausInfo[haus][haus_besitzer],HausInfo[haus][haus_preis],HausInfo[haus][Mieter1],HausInfo[haus][Mieter2],HausInfo[haus][Mieter3],HausInfo[haus][Mieter4],HausInfo[haus][Mieter5]);
TextDrawSetString(Helpdesk, hdesk);
break;
}
}
SetWorldTime(hour);
return 1;
}
//Edit I now searched again in Wiki.
If i do it what Wiki means i become a Report-Crash if i join:
PWN Code:
Код:
else if(IsPlayerInRangeOfPoint(playerid,5,HausInfo[haus][haus_x],HausInfo[haus][haus_y],HausInfo[haus][haus_z])) break;
Else if i do break; anywhere in the Code i become a Error only these 2 positions are right without errors.
Why is it always wrong? How can i fix it.
With best regards
AW: For-Loop Break;(Report Crash) -
Bloodangel - 15.10.2011
Cant anyone help me?
The Thread is so old but i dont know what I can do.
Pls help me
Sven
AW: For-Loop Break;(Report Crash) -
Nero_3D - 15.10.2011
rewritten (this doesnt fix the crash only the scripting related mistakes)
pawn Код:
public HelpdeskUp(playerid) {
new hdesk[500];
if(GetPlayerName(playerid, hdesk[100], MAX_PLAYER_NAME)) { // checks if the player is connected
new hour, minute, second, day, month, year;
gettime(hour, minute, second);
getdate(year, month, day);
switch(pInfo[playerid][admin) {
case 0: hdesk = "Normal";
case 1: hdesk = "Supporter";
case 2: hdesk = "Moderator";
case 3: hdesk = "Suprt Moderator";
case 4: hdesk = "Administrator";
case 5: hdesk = "Serverletiung";
}
format(hdesk, sizeof hdesk, "\
~w~ .::Hilfeleiste::.~n~~n~\
Rang:~r~ %s~n~\
~w~Uhrzeit:~g~ %d:%d %d~n~\
~w~Datum:~g~ %d.%d.%d~n~\
~w~Dein Nickname:~g~ %s~n~\
~w~Dein ID: %d~n~\
Kontostand:~y~ %d$~n~\
~w~Hunger/Durst:~g~ %d~n~\
~w~Energie:~g~ %d~n~\
~w~Harndrang:~g~ %d",
hdesk, hour, minute, second, day, month, year, hdesk[100], playerid, pInfo[playerid][pBank], pInfo[playerid][hunger], pInfo[playerid][energie], pInfo[playerid][harndrang]);
for(new haus = 1; haus != MAX_HAUS; ++haus) {
if(IsPlayerInRangeOfPoint(playerid, 5.0, HausInfo[haus][haus_x], HausInfo[haus][haus_y], HausInfo[haus][haus_z])) {
format(hdesk, sizeof hdesk, "%s~n~~n~\
~w~ .::Hausinfo::..~n~~n~\
~w~Besitzer: %s~n~\
Preis: %d$~n~\
Miete: %d$~n~\
Mieter 1: %s~n~\
Mieter 2: %s~n~\
Mieter 3: %s~n~\
Mieter 4: %s~n~\
Mieter 5: %s",
hdesk, HausInfo[haus][haus_besitzer], HausInfo[haus][haus_preis], HausInfo[haus][Mieter1], HausInfo[haus][Mieter2], HausInfo[haus][Mieter3], HausInfo[haus][Mieter4], HausInfo[haus][Mieter5]);
break;
}
}
TextDrawSetString(Helpdesk, hdesk);
SetWorldTime(hour);
return 1;
}
return 0;
}
and if you wanna know why gta crashes check the first gray box on
that page