Error 076
#1

Код:
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(457) : error 076: syntax error in the expression, or invalid function call
This his the code that contains 457:

Код:
//SendIPToAdmins
	new string[128],plyrname[MAX_PLAYER_NAME];
	GetPlayerName(playerid,plyrname,sizeof(plyrname));
	format(string,sizeof(string),"[ADM]%s connected with IP %d",plyrname,pIP);
	SendMessageToAdmins(0xFFFFFFAA,string);
    return 1;
}
Reply
#2

pawn Код:
//SendIPToAdmins
    new ip[999];
    new string[99];
    GetPlayerName(playerid,name,sizeof(name));
    GetPlayerIp(playerid,ip,sizeof(ip));
    format(string, 150, "[ADM]%s connected with IP %d.", name, ip);
    SendMessageToAdmins(0xFFFFFFAA,string);
Reply
#3

Quote:
Originally Posted by ScRipTeRi
Посмотреть сообщение
pawn Код:
//SendIPToAdmins
    new ip[999];
    new string[99];
    GetPlayerName(playerid,name,sizeof(name));
    GetPlayerIp(playerid,ip,sizeof(ip));
    format(string, 150, "[ADM]%s connected with IP %d.", name, ip);
    SendMessageToAdmins(0xFFFFFFAA,string);
This won't work out well, you shouldn't use %d as the IP. IP is a string also ip[999] is a waste of memory.

Try this,

pawn Код:
//SendIPToAdmins
    new string[60],pname[MAX_PLAYER_NAME+1], pIP[16];
    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerIp(playerid, pIP, sizeof(pIP));
    format(string,sizeof(string),"[ADM]%s connected with IP %s",pname,pIP);
    SendMessageToAdmins(0xFFFFFFAA,string);
    return 1;
}
Well, I'm not sure about your string size, if you want to change it go ahead.
Reply
#4

Well for starters I already have a stock for pIP:

Код:
stock pIP(playerid)
{
    new pIP[16];
    GetPlayerIP(playerid,pIP,sizeof(pIP));
    return pIP;
}
It also still returns that 1 error. The error comes strictly from this line:

Код:
format(string,sizeof(string),"[ADM]%s connected with IP %s",pname,pIP);
Also I cant use pname cause i get error "already defined"
Reply
#5

Use this without the stock:
pawn Код:
new string[60],Name[MAX_PLAYER_NAME+1], pIP[16];
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerIp(playerid, pIP, sizeof(pIP));
format(string,sizeof(string),"[ADM]%s connected with IP %s",Name,pIP);
SendMessageToAdmins(0xFFFFFFAA,string);
return 1;
Reply
#6

Thanks Jimmy and Zex Tan. I will rep you both
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)