Check For Name
#1

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
Reply
#2

I guess that's it.

https://sampwiki.blast.hk/wiki/GetPlayerName
Reply
#3

Use strcmp.
Reply
#4

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

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

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.
Reply
#7

@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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)