SA-MP Forums Archive
Need little help with SendClientMessage. - 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: Need little help with SendClientMessage. (/showthread.php?tid=246515)



Need little help with SendClientMessage. - pliptm - 04.04.2011

I tried many times but it won't come out.
What i want to do, is that when player name isn't Steven_Hayen, then he/she can't teleport. And server send text to him (ex. You don't have permissions! or something like that)

Teleport code is here.

pawn Код:
if (strcmp(cmdtext, "/telealla", true)==0)
    {
    GetPlayerName(playerid,pName,64);
    if(!strcmp(pName,"Steven_Hayen",true)) // Change Name_Name to your name.
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    SetPlayerInterior(playerid, 0);
    LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
    SetVehiclePos(GetPlayerVehicleID(playerid), 260.1984,-1230.9200,58.5478);
    SetVehicleZAngle(GetPlayerVehicleID(playerid), 180.945861);
    return 1;
    }
    else
    {
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, 260.1984,-1230.9200,58.5478);
    SetPlayerFacingAngle(playerid, 180.945861);
    return 1;
    }
    }
    }



Re: Need little help with SendClientMessage. - Placebo - 04.04.2011

Like this? Then add a return 1; after the sendclientmessage
pawn Код:
if (strcmp(cmdtext, "/telealla", true)==0)
    {
    GetPlayerName(playerid,pName,64);
    if(!strcmp(pName,"Steven_Hayen",true)) // Change Name_Name to your name.
    {
         [COLOR="Red"]SendClientMessage(playerid, COLOR_HERE, "Your name is not Steven_Hayden.  You can not teleport"[/COLOR]
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    SetPlayerInterior(playerid, 0);
    LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
    SetVehiclePos(GetPlayerVehicleID(playerid), 260.1984,-1230.9200,58.5478);
    SetVehicleZAngle(GetPlayerVehicleID(playerid), 180.945861);
    return 1;
    }
    else
    {
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, 260.1984,-1230.9200,58.5478);
    SetPlayerFacingAngle(playerid, 180.945861);
    return 1;
    }
    }
    }



Re: Need little help with SendClientMessage. - Mike Garber - 04.04.2011

Code above wont work.

pawn Код:
if (strcmp(cmdtext, "/telealla", true)==0)
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    if(!strcmp(pName,"Steven_Hayen",true)) // Change Name_Name to your name.
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            SetPlayerInterior(playerid, 0);
            LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
            SetVehiclePos(GetPlayerVehicleID(playerid), 260.1984,-1230.9200,58.5478);
            SetVehicleZAngle(GetPlayerVehicleID(playerid), 180.945861);
        }
        else
        {
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid, 260.1984,-1230.9200,58.5478);
            SetPlayerFacingAngle(playerid, 180.945861);
        }
    }
    else return SendClientMessage(playerid,COLOR_RED,"You may not teleport!");
    return 1;
}



Re: Need little help with SendClientMessage. - pliptm - 04.04.2011

Wait, i try.


Re: Need little help with SendClientMessage. - pliptm - 04.04.2011

tried to fix this, but look's like i'm way too newbie at this.

Код:
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven's Roleplay 0.3c\gamemodes\larp2.pwn(26868) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven's Roleplay 0.3c\gamemodes\larp2.pwn(26868) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven's Roleplay 0.3c\gamemodes\larp2.pwn(26868) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven's Roleplay 0.3c\gamemodes\larp2.pwn(26868) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Need little help with SendClientMessage. - Marricio - 04.04.2011

Quote:
Originally Posted by pliptm
Посмотреть сообщение
tried to fix this, but look's like i'm way too newbie at this.

Код:
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven's Roleplay 0.3c\gamemodes\larp2.pwn(26868) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven's Roleplay 0.3c\gamemodes\larp2.pwn(26868) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven's Roleplay 0.3c\gamemodes\larp2.pwn(26868) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven's Roleplay 0.3c\gamemodes\larp2.pwn(26868) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Next time use EDIT button and not doublepost....


Re: Need little help with SendClientMessage. - pliptm - 04.04.2011

Mike, i will try your's


Re: Need little help with SendClientMessage. - Mike Garber - 04.04.2011

Why didn't you try mine from the beginning? I said at my post that Placeboo's code wouldn't work.


Re: Need little help with SendClientMessage. - pliptm - 04.04.2011

I don't know, at the beginning i saw only Placeboo's code and then i tried his, but now i tried yours and it worked.
Thanks a lot.


Re: Need little help with SendClientMessage. - Mike Garber - 04.04.2011

No problem.