Learning more about SA:MP Scripting
#1

Hello Scripters! i've always been wanting to make a script of my own been trying now for almost 3 and a half year. I've always wanted to learn more about stuff, and it's not really the easiest thing. I've now through my years learnt alot more than i could of ever imagine. Although it feels as if my final lesson would be to learn on how to use parameters. I wish someone could contact me and give me a basic point of view on how the parameters etc system works. As for example on how a command such as /pm [id] [message] works and what all these different parameters actually does in the script.

Skype: Zooth91

Please feel free to contact me! i'd appricate it alot!
Reply
#2

I've done this now:

pawn Код:
CMD:pm(playerid, params[])
{
    new string[128], giveplayerid, message[50];
    if(sscanf(params,"us[50]",giveplayerid, message)) return SendClientMessage(playerid, -1, "USAGE: /PM [playerid][message]");
    if(IsPlayerConnected(giveplayerid) && giveplayerid != INVALID_PLAYER_ID)
    {
        format(string,sizeof(string),"PM Message from (%s): %s", ReturnPlayerName(playerid), message);
        SendClientMessage(giveplayerid, COLOR_ORANGE, string);
    }
    SendClientMessage(playerid, -1, "The message was sent successfully!.");
    return 1;
}


stock ReturnPlayerName(playerid)
{
    new szName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, szName, sizeof(szName));
    return szName;
}
I hope that I helped you, it took from me 2 minutes or something to create it so I didnt test it at all.
Reply
#3

Thanks for the post! going to try it right away!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)