Help me to Fix this problem please.
#1

Hi, Can someone help me to fix this problem, Sorry, I'm newbie at scripting.

PHP код:
public OnPlayerConnect(playerid)
{
    new 
MSG[250];
    new 
Name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,Name,sizeof(Name));
    new 
Ip;
    
GetPlayerIp(playerid,Ip,sizeof(Ip));
    
format(MSG,sizeof(MSG),"Player %s | IP: %s has entered in the server"NameIp);
    
SendClientMessageToAll(GREEN,MSG);
    return 
1;

It gives me 2 errors:

G:\PAWN Stuff\SA-MP Server\filterscripts\Arrays.pwn(4 : error 035: argument type mismatch (argument 2)
G:\PAWN Stuff\SA-MP Server\filterscripts\Arrays.pwn(4 : error 035: argument type mismatch (argument 2)
Reply
#2

new Ip;

Ip needs a size
new Ip[55];
Reply
#3

Oh thanks.
I added a score array.
It gives me 2 warnings:
PHP код:
public OnPlayerConnect(playerid)
{
    new 
MSG[250];
    new 
Name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,Name,sizeof(Name));
    new 
Ip[256];
    
GetPlayerIp(playerid,Ip,sizeof(Ip));
    new 
score;
    
GetPlayerScore(playerid,score,sizeof(score));//That's the warning line.
    
format(MSG,sizeof(MSG),"Player %s | IP: %s | Score: %s has entered in the server"NameIpscore);
    
SendClientMessageToAll(GREEN,MSG);
    return 
1;

Код:
G:\PAWN Stuff\SA-MP Server\filterscripts\Arrays.pwn(50) : warning 202: number of arguments does not match definition
G:\PAWN Stuff\SA-MP Server\filterscripts\Arrays.pwn(50) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#4

do this instead
pawn Код:
new score = GetPlayerScore(playerid);
Reply
#5

Because you're havin 3 parameters in GetPlayerScore which takes only one parameter (playerid) (Click for more info: GetPlayerScore). Here you go:

pawn Код:
new score = GetPlayerScore(playerid);
Reply
#6

It's supposed to be just GetPlayerScore(playerid); Don't add anything else.
Reply
#7

I added a ping array:
Is the %i right or wrong?

PHP код:
public OnPlayerConnect(playerid)
{
    new 
MSG[250];
    new 
Name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,Name,sizeof(Name));
    new 
Ip[256];
    
GetPlayerIp(playerid,Ip,sizeof(Ip));
    new 
score GetPlayerScore(playerid);
    new 
ping =     GetPlayerPing(playerid);
    
format(MSG,sizeof(MSG),"Player %s | IP: %s | Score: %s | Ping: %i has entered in the server"NameIpscoreping);//%i, Is this right or wrong?
    
SendClientMessageToAll(GREEN,MSG);
    return 
1;

Reply
#8

It should be %d instead.
Reply
#9

Yes, since GetPlayerPing returns an integer value. Oh but, Score shouldn't have %s as a placeholder, it should be treated just like ping (%i or %d).
Reply
#10

Okay, This is my last question.
new kills = PlayerInfo[playerid][pKills];//Is that right?
PHP код:
public OnPlayerConnect(playerid)
{
    new 
MSG[250];
    new 
Name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,Name,sizeof(Name));
    new 
Ip[256];
    
GetPlayerIp(playerid,Ip,sizeof(Ip));
    new 
score GetPlayerScore(playerid);
    new 
ping =     GetPlayerPing(playerid);
    new 
kills PlayerInfo[playerid][pKills];//Is that right?
    
format(MSG,sizeof(MSG),"Player %s | IP: %s | Score: %s | Ping: %i | Kills: %s has entered in the server"NameIpscorepingkills);
    
SendClientMessageToAll(GREEN,MSG);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)