SA-MP Forums Archive
Make Equipments . - 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: Make Equipments . (/showthread.php?tid=84628)



Make Equipments . - bpancakes41 - 02.07.2009

Hello,I'm frensh,So my english isn't very good Sorry.

Today,I want to do a commands.The Players will going on a "i" Points and he can chose an Equipment
Exemple:

/equipments 1: The player Have got a Shotgun,a MP5 and a policeman Skin for exemple
/equipments 9: The player have got a M4,a Deagle and a FBI or SWAT Skin

Thanks you VeryMuch.

Sorry for my english =S


Re: Make Equipments . - refshal - 02.07.2009

Script Request Thread.


Re: Make Equipments . - bpancakes41 - 02.07.2009

So I don't know..How can I do it?
I'm not a very Good Scripter,so I just want a Script or a model because .. It's to difficult for me.


Re: Make Equipments . - killerx100 - 02.07.2009

pawn Код:
// At top of script
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);

//OnGAmeModeInit
AddStaticPickup(1239, 1, X,Y,Z);

//OnPlayerCommandText
    if(strcmp(cmd, "/equipment", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(PlayerToPoint(4,playerid,X,Y,Z)
    {
        new x_nr[256];
                x_nr = strtok(cmdtext, idx);
                if(!strlen(x_nr)) {
                    SendClientMessage(playerid, COLOR, " /equpment [number] :.");
                    SendClientMessage(playerid, COLOR, "Available names: 1,2");
                    return 1;
                }
            if(strcmp(x_nr,"1",true) == 0)
                {
                SetPlayerSkin(playerid,285);
                GivePlayerWeapon(playerid, 41, 500);
                GivePlayerWeapon(playerid, 24, 200);
                GivePlayerWeapon(playerid, 3, 1);
                return 1;
                 }
                    else if(strcmp(x_nr,"2",true) == 0)
                {
                SetPlayerSkin(playerid,285);
                GivePlayerWeapon(playerid, 41, 500);
                GivePlayerWeapon(playerid, 24, 200);
                GivePlayerWeapon(playerid, 3, 1);
                return 1;
                 }
      }
}
return 1;
}
 
 

//callbacks
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' ')) { index++; }
    new offset = index; new result[30];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    { result[index - offset] = string[index]; index++; }
    result[index - offset] = EOS; return result;
}


public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
    {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
        //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}



Re: Make Equipments . - bpancakes41 - 02.07.2009

THANKS YOU !!




Re: Make Equipments . - refshal - 02.07.2009

pawn Код:
if(!strcmp(cmdtext, "/equipments 1", true == 0))
{
SetPlayerSkin(playerid,280);    
GivePlayerWeapon(playerid,29,200);
GivePlayerWeapon(playerid,25,70);
return 1;
}
pawn Код:
if(!strcmp(cmdtext, "/equipments 2", true == 0))
{
SetPlayerSkin(playerid,286);    
GivePlayerWeapon(playerid,31,200);
GivePlayerWeapon(playerid,23,70);
return 1;
}
Just another suggestion.