Name scripting - 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: Name scripting (
/showthread.php?tid=207327)
Name scripting -
Jack- - 05.01.2011
how do i fix this error
Код:
(26) : error 017: undefined symbol "PlayerName"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/lockdown", cmdtext, true, 10) == 0)
{
if(!strcmp(PlayerName(playerid), "Jack" ))
SendClientMessageToAll(COLOUR_RED,"WARNING: Abandoned Airfield On Lock Down");
MoveObject(window, 413.834960,2530.024169,20.169763, 2.500);
MoveObject(window1, 411.896423,2530.024169,20.192766, 2.500);
MoveObject(window2, 411.978424,2530.058105,20.166105, 2.500);
MoveObject(window3, 416.770385,2530.058105,20.174055, 2.500);
return 1;
}
Re: Name scripting -
John_F - 05.01.2011
GetPlayerName, not PlayerName
Re: Name scripting -
Jack- - 05.01.2011
I now get this
Код:
(26) : warning 202: number of arguments does not match definition
(26) : warning 202: number of arguments does not match definition
(26) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
pawn Код:
if (strcmp("/vshut", cmdtext, true, 10) == 0)
{
if(!strcmp(GetPlayerName(playerid), "Jack" ))
SendClientMessageToAll(COLOUR_RED,"WARNING: Abandoned Airfield On Lock Down");
MoveObject(window, 413.834960,2530.024169,20.169763, 2.500);
MoveObject(window1, 411.896423,2530.024169,20.192766, 2.500);
MoveObject(window2, 411.978424,2530.058105,20.166105, 2.500);
MoveObject(window3, 416.770385,2530.058105,20.174055, 2.500);
return 1;
}
Re: Name scripting -
Calgon - 05.01.2011
pawn Код:
if (strcmp("/vshut", cmdtext, true, 10) == 0)
{
new
playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
if(!strcmp(playerName, "Jack", true)) {
SendClientMessageToAll(COLOUR_RED,"WARNING: Abandoned Airfield On Lock Down");
MoveObject(window, 413.834960,2530.024169,20.169763, 2.500);
MoveObject(window1, 411.896423,2530.024169,20.192766, 2.500);
MoveObject(window2, 411.978424,2530.058105,20.166105, 2.500);
MoveObject(window3, 416.770385,2530.058105,20.174055, 2.500);
}
return 1;
}
Re: Name scripting -
Jack- - 05.01.2011
Thank you for your help, Its much appreciated
Re: Name scripting -
Jack- - 05.01.2011
Does this make the command only available to the person who is scripted in?
Re: Name scripting -
John_F - 05.01.2011
This makes it so the only person who can use the command is a person named Jack.
I don't remember if strcmp will allow also return the same for a person such as Jack_S.