[HELP] compile crash - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] compile crash (
/showthread.php?tid=89068)
[HELP] compile crash -
The_Tough - 30.07.2009
everytime I place in my script the following code it allways crashes
Код:
new i=0; i<length; i++)
I maybe use i<SLOTS; and it keep crashing whats the reason?
Re: [HELP] compile crash -
Khelif - 30.07.2009
pawn Код:
for(new i = 0; i < lenght; i++)
Re: [HELP] compile crash -
The_Tough - 30.07.2009
It keeps crashing...neither that helps
I use it to make an admin filterscript and I wanna use it here
Код:
dcmd_akill(playerid, params[])
if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[AKILL])
{
new string[100];
format(string, sizeof(string), "You must be administrator level %d to use that command!", gCommands[AKILL]);
return SendClientMessage(playerid, COLOUR_ORANGE, string);
}
else if(!strlen(params))
return SendClientMessage(playerid, COLOUR_ORANGE, "USAGE: /akill [id | name]");
else
{
for new(i = 0; i < length; i++; ) // here
if(IsPlayerConnected(i) && i != playerid)
{
SetPlayerHealth(id, 0.0);
new string[150];
format(string, sizeof(string), "You have been admin-killed by administrator \'%s\'.", gPlayerInfo[playerid][PLAYER_NAME]);
SendClientMessage(i, COLOUR_ORANGE, string);
format(string, sizeof(string), "You have successfully admin-killed player \'%s\'.", gPlayerInfo[id][PLAYER_NAME]);
return SendClientMessage(playerid, COLOUR_LIGHTBLUE, string);
}
else
return SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: You can not admin-kill yourself or a disconnected player.");
}
also I tried with IsNumeric
Код:
stock IsNumeric(const string[]) //By Jan "DracoBlue" Schьtze (edited by Gabriel "Larcius" Cordes
{
new length=strlen(string);
if(length==0)
{
return 0;
}
for (new i=0; i<length; i++)
{
if (!((string[i] <= '9' && string[i] >= '0') || (i==0 && (string[i]=='-' || string[i]=='+'))))
{
return false;
}
}
return 0;
}
because I dont know any other way to send a client message to the akilled ID,not the one who uses the command...
Re: [HELP] compile crash -
illay - 30.07.2009
Use sscanf and dcmd

(Example in gAdmin...)
Re: [HELP] compile crash -
Khelif - 30.07.2009
try this
Код:
dcmd_akill(playerid,params[])
{
if(gPlayerInfo[playerid][PLAYER_LEVEL] > gCommands[AKILL])
{
if(!strlen(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /akill [id | name]");
new player1, new string[128];
player1 = strval(params);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
GetPlayerName(player1, playername, sizeof(playername));
format(string,sizeof(string),"You have successfully admin-killed player \'%s\'.", PlayerName(player1));
SendClientMessage(playerid,COLOUR_ORANGE,string);
format(string, sizeof(string), "You have been admin-killed by administrator \'%s\'.", PlayerName(playerid));
SendClientMessage(player1, COLOUR_ORANGE, string);
return SetPlayerHealth(player1, 0.0);
}else return SendClientMessage(playerid, red, "Player is not connected!");
}else{
format(string, sizeof(string), "You must be administrator level %d to use that command!", gCommands[AKILL]);
return SendClientMessage(playerid, COLOUR_ORANGE, string);
}
}
Код:
stock PlayerName(playerid) {
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
return Name;
}
Re: [HELP] compile crash -
kaisersouse - 30.07.2009
1) a common reason for a COMPILER crash is too many } in the script.
2) targetid = strval(params);