SA-MP Forums Archive
/sms command - 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)
+--- Thread: /sms command (/showthread.php?tid=522409)



/sms command - Tadas - 27.06.2014

Hello all!
I wrote a /sms command and I stuck on one part.
How can I make than person can not send himself a message?
I tryed something like this:
pawn Код:
if(GetPlayerName(playerid) == Sender)
        return SendClientMessage(playerid, RED, "You can not send a message to yourself");
But the aray must be indexed.
So any ideas ?

Sorry for my bad English.


Re: /sms command - AdHaM612 - 27.06.2014

Can you show all /sms command ?


Re: /sms command - Noliax8 - 27.06.2014

if Sender is a number (0, 1, 2..), it's

PHP код:
if(playerid == Sender) return SendClientMessage(...); 
Nlx.


Re: /sms command - Tadas - 27.06.2014

Sure:
pawn Код:
CMD:sms(playerid, params[])
    {
    new PID;
    new tekstas[50];
    new str[128];
    new Gavejas[MAX_PLAYER_NAME], Siuntejas[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Siuntejas, sizeof(Siuntejas));
    GetPlayerName(PID, Gavejas, sizeof(Gavejas));
    if(sscanf(params, "us", PID,tekstas)) return SendClientMessage(playerid, ZALIA, "Naudojimas: /sms [ Gavлjo Vardas ] [ Tekstas ]");
    if(!IsPlayerConnected(PID))
        return SendClientMessage(playerid, ORANDZINE, "Tokio юaidлjo nлra!");
    format(str, sizeof(str), "[SMS] %s: %s .", Siuntejas, tekstas);
    SendClientMessage(PID, 0x459466FF, str);
    SendClientMessage(playerid, 0x459466FF, str);
    PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
    return 1;
    }



Re: /sms command - Noliax8 - 27.06.2014

PHP код:
if(playerid == PID) return SendClientMessage(...); 
Nlx.


Re: /sms command - Tadas - 27.06.2014

Quote:
Originally Posted by Noliax8
Посмотреть сообщение
PHP код:
if(playerid == PID) return SendClientMessage(...); 
Nlx.
Thanks, it's working
+Rep


Re: /sms command - Noliax8 - 27.06.2014

I hope you learnt, else it's not useless that I give the pawncode without you do understand...