Make Equipments .
#4

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


Messages In This Thread
Make Equipments . - by bpancakes41 - 02.07.2009, 07:43
Re: Make Equipments . - by refshal - 02.07.2009, 08:20
Re: Make Equipments . - by bpancakes41 - 02.07.2009, 08:39
Re: Make Equipments . - by killerx100 - 02.07.2009, 08:47
Re: Make Equipments . - by bpancakes41 - 02.07.2009, 08:51
Re: Make Equipments . - by refshal - 02.07.2009, 08:53

Forum Jump:


Users browsing this thread: 2 Guest(s)