/sms command
#1

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

Can you show all /sms command ?
Reply
#3

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

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

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

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

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)