SA-MP Forums Archive
Check For Name - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Check For Name (/showthread.php?tid=188032)



Check For Name - Hal - 06.11.2010

I need to have my script check the file to see if the name matches the players name.

pawn Код:
if Businesses[id][bOwner] = GetName(playerid) // Line 14425
{                                             // Line 14426
Errors when i use the GetName(playerid)
Код:
C:\DRIVE\gamemodes\script.pwn(14425) : warning 211: possibly unintended assignment
C:\DRIVE\gamemodes\script.pwn(14426) : error 047: array sizes do not match, or destination array is too small
Thanks


Re: Check For Name - marko94 - 06.11.2010

I guess that's it.

https://sampwiki.blast.hk/wiki/GetPlayerName


Re: Check For Name - Retardedwolf - 06.11.2010

Use strcmp.


Re: Check For Name - Hal - 06.11.2010

Quote:
Originally Posted by marko94
Посмотреть сообщение
the stock GetName returns the name of the playerid


Re: Check For Name - ViruZZzZ_ChiLLL - 06.11.2010

pawn Код:
if(Businesses[id][bOwner] == GetName(playerid)) // Line 14425
{    
  // some codes here
}



Re: Check For Name - Hal - 06.11.2010

Quote:
Originally Posted by ViruZZzZ_ChiLLL
Посмотреть сообщение
pawn Код:
if(Businesses[id][bOwner] == GetName(playerid)) // Line 14425
{    
  // some codes here
}
thanks, but one question if anyone wants to answer. What is the difference with on‌e = or two ? i read it somewhere a while back, but i guess i'll look right now.


Re: Check For Name - Retardedwolf - 06.11.2010

@ViruZZzZ_ChiLLL, That won't work cause they are both strings (Guessing)

pawn Код:
if ( !strcmp ( Businesses[ id ][ bOwner ], GetName ( playerid ) )

@Hal, 1 '=' is to set the variable. and two is to check well thats what I know of