SA-MP Forums Archive
I need help making my own stock - 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: I need help making my own stock (/showthread.php?tid=367210)



I need help making my own stock - ddnbb - 09.08.2012

So, i want to do like: SendMeMessage(playerid, "takes out his %s.", weaponname);

The stock obviously includes Proxdetector and player name and color and that stuff etc. Just that, SendMeMessage could be done like in the example. I've done many cool stocks for myself, but i cant imagine how i can do this one. All help is appreticated!


Re: I need help making my own stock - Devilxz97 - 09.08.2012

format is easy,
pawn Код:
new string[256];
    format(string, sizeof(string), "takes out his %s", weaponname);
    SendMeMessage(playerid, -1, string);



Re: I need help making my own stock - grand.Theft.Otto - 09.08.2012

Quote:
Originally Posted by Devilxz97
Посмотреть сообщение
format is easy,
pawn Код:
new string[256];
    format(string, sizeof(string), "takes out his %s", weaponname);
    SendMeMessage(playerid, -1, string);
Not like that ... like this:

pawn Код:
stock SendMeMessage(playerid)
{
    new string[128], name[24], weapon;
   
    weapon = GetPlayerWeapon(playerid);
   
    GetPlayerName(playerid,name,24);
   
    if(weapon == 9) // chainsaw
    {
        format(string,128,"%s (%d) Takes Out His Chainsaw.",name,playerid);
    }
    return 1;
}
In a command, use SendMeMessage(playerid);

Note: This stock is just an example and is only getting weapon id 9 which is a chainsaw and will not work for anything else unless you modify it yourself. Just skim through it so you understand it better.


Re: I need help making my own stock - ddnbb - 09.08.2012

I think you understood me wrong. It was just an example, i want to write everything with that stock, not only weapon names...

Like:
SendMeMessage(playerid, "opens the door."); ------> * Micheal opens the door.
SendMeMessage(playerid, "takes out his %s", weapon); ------> * Micheal takes out his Deagle.
SendMeMessage(playerid, "thinks of number %d", number); ------> * Micheal thinks of number 10.

I hope you get me? The format in this is what i need.


Re: I need help making my own stock - Devilxz97 - 09.08.2012

hmm

pawn Код:
/*I think you understood me wrong. It was just an example, i want to write everything with that stock, not only weapon names...

Like:
SendMeMessage(playerid, "opens the door."); ------> * Micheal opens the door.
SendMeMessage(playerid, "takes out his %s", weapon); ------> * Micheal takes out his Deagle.
SendMeMessage(playerid, "thinks of number %d", number); ------> * Micheal thinks of number 10.

I hope you get me? The format in this is what i need.*/


    new pname[MAX_PLAYER_NAME], string[256];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s has open the door.", pname);
    SendClientMessage(playerid, -1, string);
  //SendMeMessage(playerid, "opens the door."); ------> * Micheal opens the door.
 
    new weapon, string[256], pname[MAX_PLAYER_NAME];
    weapon = GetPlayerWeapon(playerid);
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s takes out his weapon %s", pname, weapon);
    SendClientMessage(playerid, -1, string);
  //SendMeMessage(playerid, "takes out his %s", weapon); ------> * Micheal takes out his Deagle.
 
    new pname[MAX_PLAYER_NAME], number, string[256];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s thinks of number %d", pname, number);
    SendClientMessage(playerid, -1, string);
  //SendMeMessage(playerid, "thinks of number %d", number); ------> * Micheal thinks of number 10.