SA-MP Forums Archive
Help me to Fix this problem please. - 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: Help me to Fix this problem please. (/showthread.php?tid=390077)



Help me to Fix this problem please. - Magic_Time - 04.11.2012

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)


Re: Help me to Fix this problem please. - tyler12 - 04.11.2012

new Ip;

Ip needs a size
new Ip[55];


Respuesta: Help me to Fix this problem please. - Magic_Time - 04.11.2012

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.



Re: Help me to Fix this problem please. - YoYo123 - 04.11.2012

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



Re: Help me to Fix this problem please. - [KHK]Khalid - 04.11.2012

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);



Re: Help me to Fix this problem please. - Dawnz - 04.11.2012

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


Respuesta: Help me to Fix this problem please. - Magic_Time - 04.11.2012

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;




Re: Help me to Fix this problem please. - Dawnz - 04.11.2012

It should be %d instead.


Re: Help me to Fix this problem please. - [KHK]Khalid - 04.11.2012

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).


Respuesta: Help me to Fix this problem please. - Magic_Time - 04.11.2012

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;