Jump to content

[PAWN] ResetPlayerWeapons


Tupi
 Share

Recommended Posts

~ ResetPlayerWeapons ~

 

Înainte de toate eu am folosit include-ul: a_samp, sscanf2, zcmd și am definit SCM-ul.

include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <foreach>
  
#define SCM SendClientMessage

 

Putem crea o comandă prin care vom dezarma un anumit jucator folosindu-ne de:

ResetPlayerWeapons(playerid);
CMD:disarm(playerid, params[])
{
    new id, string[128], sendername[16], giveplayer[16];
    if(sscanf(params, "u", id)) return SCM(playerid, -1, "Use: /disarm <PlayerName/PlayerID>");
    if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SCM(playerid, -1, "Error: This player is not online!");
	
    ResetPlayerWeapons(id);
  	
    GetPlayerName(playerid, sendername, 16);
    GetPlayername(id, giveplayer, 16);
  
    format(string, sizeof string, "L-ai dezarmat pe %s.", giveplayer);
    SCM(playerid, -1, string);
    format(string, sizeof string, "Ai fost dezarmat de catre adminul %s.", sendername);
    SCM(id, -1, string);
      
    return 1;
}

 

Putem crea o comandă prin care să dezarmam toti jucatorii de pe server sau pe cei de pe o anumită rază folosindu-ne tot de:

ResetPlayerWeapons(playerid);
CMD:disarmall(playerid, params[])
{
    new range, Float: Pos[3];
    if(sscanf(params, "i", range)) return SCM(playerid, -1, "Use: /disarmall <range (0 - global)>");
    if(range < 0) return SCM(playerid, -1, "Invalid range!");
    
    foreach(Player, p) {
        if(IsPlayerConnected(p) {
             if(range == 0) ResetPlayerWeapons(p);
             else {
                    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2];
                    if(IsPlayerInRangeOfPoint(p, range, Pos[0], Pos[1], Pos[2]) ResetPlayerWeapons(p);
             }
        }
    }
    return 1;
}

 

* Pentru orice întrebare/nelămurire puteți trimite un PM la un Programmer sau să deschideți un topic in secțiunea Help and Discussions.

 

Edited by Tupi
Link to comment
Share on other sites

  • Tupi locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.