SA-MP Forums Archive
One Error, Please help me with my script. - 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: One Error, Please help me with my script. (/showthread.php?tid=361712)



One Error, Please help me with my script. - VladCanarez - 21.07.2012

Alright, I've followed the steps of some tutorial to add a /ajail CMD yet i keep getting 1 Error.

Errors:
Код:
C:\Users\Cyrus\Desktop\ZG-RP\gamemodes\ZGRP.pwn(37) : warning 201: redefinition of constant/macro (symbol "strcpy(%0,%1,%2)")
C:\Users\Cyrus\Desktop\ZG-RP\gamemodes\ZGRP.pwn(6527) : error 017: undefined symbol "Name"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
My script : http://pastebin.com/VNw9NBR3


Re: One Error, Please help me with my script. - Kindred - 22.07.2012

You redefined strcpy, hence forth the obvious error. Remove that line.

Name is undefined, define it. It looks like you are using it as a stock, so place this near your other stocks

pawn Код:
stock Name(playerid)
{
    if(!IsPlayerConnected(playerid)) return 1;
    new pName[24];
    GetPlayerName(playerid, pName, sizeof(pName));
    return pName;
}



Re: One Error, Please help me with my script. - VladCanarez - 22.07.2012

I've just added that stock near my others and now i have another error.
Код:
 C:\Users\Cyrus\Desktop\ZG-RP\gamemodes\ZGRP.pwn(675) : error 079: inconsistent return types (array & non-array)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: One Error, Please help me with my script. - Kindred - 22.07.2012

What line is that shown on?


Re: One Error, Please help me with my script. - Devilxz97 - 22.07.2012

top of your script ,
pawn Код:
new Name[MAX_PLAYER_NAME];



Re: One Error, Please help me with my script. - VladCanarez - 22.07.2012

675:
Код:
 if(!IsPlayerConnected(playerid)) return 1;



Re: One Error, Please help me with my script. - Kindred - 22.07.2012

Just remove that line, not really needed.


Re: One Error, Please help me with my script. - Devilxz97 - 22.07.2012

pawn Код:
new pID;
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Player is not Connected! ");//checks if player is not connected



Re: One Error, Please help me with my script. - VladCanarez - 22.07.2012

Thanks Kindred +Rep'd


Re: One Error, Please help me with my script. - Kindred - 22.07.2012

Quote:
Originally Posted by Devilxz97
Посмотреть сообщение
pawn Код:
new pID;
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Player is not Connected! ");//checks if player is not connected
Lols, seriously, learn to script before you do this shit.

It was probably because of the return 1, considering I was returning a string if it was getting his name and returning a value if not.

This code simply creates a random variable, does nothing with it, and sees if a player is online with it. If you did this, it would check if player id 0 is online, since 0 is the default value of the variable (if correct).