Name scripting
#1

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

GetPlayerName, not PlayerName
Reply
#3

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;
    }
Reply
#4

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;
    }
Reply
#5

Thank you for your help, Its much appreciated
Reply
#6

Does this make the command only available to the person who is scripted in?
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)