few errors - 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: few errors (
/showthread.php?tid=649019)
few errors -
ivndosos - 01.02.2018
I'm currently experiencing few errors,
So when the stock is like that I have errors:
Код:
stock SendMessageToAdmins(text[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[playerid][Admin] =< 1 (i))
{
SendClientMessage(i, -1, text);
}
}
}
but if I change this
Код:
if(pInfo[playerid][Admin]=< 1 (i))
to
Код:
if(IsPlayerAdmin(i))
I get errors
Код:
C:\Users\yan\Desktop\SA-MP Server\gamemodes\DBv1.pwn(1847) : error 017: undefined symbol "playerid"
C:\Users\yan\Desktop\SA-MP Server\gamemodes\DBv1.pwn(1847) : warning 215: expression has no effect
C:\Users\yan\Desktop\SA-MP Server\gamemodes\DBv1.pwn(1847) : error 001: expected token: ";", but found ")"
C:\Users\yan\Desktop\SA-MP Server\gamemodes\DBv1.pwn(1847) : error 029: invalid expression, assumed zero
C:\Users\yan\Desktop\SA-MP Server\gamemodes\DBv1.pwn(1847) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Код:
CMD:report(playerid, params[])
{
new id, reason[150];
if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) /report [id] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) The player you're trying to report is not connected!");
new str[150], sender[MAX_PLAYER_NAME], receiver[MAX_PLAYER_NAME];
GetPlayerName(playerid, sender, sizeof(sender));
GetPlayerName(id, receiver, sizeof(receiver));
format(str, sizeof(str), "(FF0000}(REPORT) {FFFFFF}%s {FF0000}has reported {ffffff}%s {FF0000} for {FFFFFF}: %s", sender, receiver, reason);
SendMessageToAdmins(str);
SendClientMessage(playerid, -1, "{809fff}(INFO) Your report has been successfully sent!");
return 1;
}
stock SendMessageToAdmins(text[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[playerid][Admin](i))
{
SendClientMessage(i, -1, text);
}
}
}
Re: few errors -
Mugala - 01.02.2018
you're using playerid, instead of i.
Код:
stock SendMessageToAdmins(text[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[i][Admin] >= 1)
{
SendClientMessage(i, -1, text);
}
}
}
P.S. IsPlayerAdmin <-- function, detects only RCON logined users as admin.
Re: few errors -
ivndosos - 01.02.2018
thanks.