commands error, (easy +rep)
#5

I will paste a command as an example

Код:
	if(strcmp(cmd, "/slap", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
   if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /slap [playerid/PartOfName]");
				return 1;
			}
			new playa;
			new Float:shealth;
			new Float:slx, Float:sly, Float:slz;
			playa = strval(tmp);
   			if (PlayerInfo[playerid][pAdmin] >=1)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
			            if(PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin])
				        {
							SendClientMessage(playerid, COLOR_LIGHTRED, "Don't try slap higher ranks !");
							SetPlayerHealth(playerid, 0);
							return 1;
				        }
				        gettime(hour, minute, second);
						getdate(year, month, day);
				        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						GetPlayerHealth(playa, shealth);
						SetPlayerHealth(playa, shealth-5);
						GetPlayerPos(playa, slx, sly, slz);
						SetPlayerPos(playa, slx, sly, slz+5);
						PlayerPlaySound(playa, 1130, slx, sly, slz+5);
						printf("AdmCmd: %s slapped %s",sendername,  giveplayer);
						format(string, sizeof(string), "AdmCmd: %s was slapped by %s",giveplayer ,sendername);
						ABroadCast(COLOR_LIGHTRED,string,1);
						format(string, sizeof(string),"-\n\n-[%s %i, %i] - [%i-0%i-0%i] %d %s Slapped %s", Months[month], day, year, hour, minute, second, PlayerInfo[playerid][pAdmin],sendername, giveplayer);
						AdminLog(string);
					}
				}
			}
		}
		return 1;
	}
Hope it gives you some insight
Reply


Messages In This Thread
commands error, (easy +rep) - by Marco_Valentine - 21.03.2012, 13:17
Re: commands error, (easy +rep) - by Ahrim - 21.03.2012, 13:25
Re: commands error, (easy +rep) - by Marco_Valentine - 21.03.2012, 13:29
Re: commands error, (easy +rep) - by Daddy Yankee - 21.03.2012, 14:30
Re: commands error, (easy +rep) - by Marco_Valentine - 21.03.2012, 15:43

Forum Jump:


Users browsing this thread: 1 Guest(s)