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



Help Please - laser50 - 13.04.2010

hey guys, im trying to do something witch gives errors, when a player connects, the system checks if he got the tag [LSPD], if he does, he will be set in the Police team... but i get errors

Код:
public OnPlayerConnect(playerid)
{
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pName, sizeof(pName));
  if(GetPlayerName(playerid, pName, sizeof(pName)) == "[LSPD]%s", pName)
  {
  SetPlayerTeam(playerid, 1);
  
  }
	return 1;
}
AND i think this is wrongly scripte, could someone help me please?


Re: Help Please - Mechscape - 13.04.2010

Show error's


Re: Help Please - laser50 - 13.04.2010

Код:
C:\Documents and Settings\Wouter\Bureaublad\SA-MP Scripting\pawno\NEW-RP.pwn(65) : error 033: array must be indexed (variable "-unknown-")
on the if(getplayername code.



Re: Help Please - cessil - 13.04.2010

use strcmp



Re: Help Please - laser50 - 13.04.2010

wut? explain please...

I cant use a command for this :/


Re: Help Please - aircombat - 13.04.2010

try this (Will Work) :
Код:
OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
new namecheck[128];
format(namecheck,sizeof(namecheck),"[LSPD]%s",name);
if(strcmp(name, namecheck) == 0)
{
SetPlayerTeam(playerid, 1);
return 1;
}
return 1;
}