Jump to content
  • 0

Disarm Command


Kristu23

Question

Salut tot am incercat sa fac un script simplu prin care adminul sa nu neaprat admin,orice jucator sa-i poata da altuia /disarm si sa ii stearga orice arma si daca vrea sa spawneze arma din hack sa nu poata...stiti voi cam cum as putea?

aadmin l-am pus am urmat tot tutorialu sa il pun exact tot cu  include si scriptfile tot....si la orice comanda de admin imi da unknow deci alt FS daca stiti sau puteti va rog.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

[tt]CMD:disarm(playerid,params[])

{

if(!strlen(params))return SendClientMessage(playerid,-1,"Usage: disarm <id>");

if(!IsPlayerConnected(strval(params))return SendClientMessage(playerid,-1,"Invalid ID!");

ResetPlayerWeapons(strval(params));

return 1;

}

[/tt]

zcmd(+tut): http://www.sa-mp.ro/forum/index.php/topic,6398.0.html

-daca ai strtok si 'cmd' in OnPlayerCommandText:

[tt]if(strcmp(cmd,"/disarm",false)==0)

{

new params[256];

params=strtok(cmdtext,idx);

if(!strlen(params))return SendClientMessage(playerid,-1,"Usage: disarm <id>");

if(!IsPlayerConnected(strval(params))return SendClientMessage(playerid,-1,"Invalid ID!");

ResetPlayerWeapons(strval(params));

return 1;

}[/tt]

Link to comment
Share on other sites

Am facut ce am putut dar am ajuns aici...

[b]error 017: undefined symbol "strtok"
error 033: array must be indexed (variable "params")
error 001: expected token: ")", but found "return"[/b]

in loc the  "cmd" am pus cmdtext ca daca nu imi dadea la fel Undefined symbol ca la strtok.

Link to comment
Share on other sites

    if(strcmp(cmd, "/disarm", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /disarm [playerid/PartOfName]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 0)
			{
				if(IsPlayerConnected(giveplayerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
						format(string, sizeof(string), "Iai resetat armele lui [ %s ]", giveplayer);
                        SendClientMessage(playerid, COLOR_GRAD2, string);
                        ResetPlayerWeapons(giveplayerid);
						return 1;
					}
				}
			}
		}
		return 1;
	}

i0418xcttya707ofg.jpg

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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. For more details you can also review our Terms of Use and Privacy Policy.