V-Admin help (/explode)
#1

When I am trying to explode id:1 or w/e it's says: Invalid ID. :P How to fix this?
Код:
	if(strcmp(cmd, "/explode", true) == 0)
	{
    	if(PlayerInfo[playerid][pAdmin] < 4) return DenyMessage(playerid, 4);
	  	tmp = strtok(cmdtext, idx);
	  	giveplayerid = ReturnUser(tmp);
		if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /explode [playerid/PartOfName] [reason]");
	  if(PlayerInfo[playerid][pAdmin] < PlayerInfo[giveplayerid][pAdmin]) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't blow-up a higher level Admin !");
 		if(giveplayerid != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
  	GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
		GetPlayerName(playerid, sendername, sizeof(sendername));
		new length = strlen(cmdtext);
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
			idx++;
		}
		new offset = idx;
		new result[64];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
			result[idx - offset] = cmdtext[idx];
			idx++;
		}
		result[idx - offset] = EOS;
		if(!strlen(result)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /explode [playerid/PartOfName] [reason]");
		new Float:X,Float:Y,Float:Z;
		if(!IsPlayerInAnyVehicle(giveplayerid))
		{
			format(string, sizeof(string), "\"%s\" was blown-up by Admin \"%s\". Reason: (%s)", giveplayer, sendername, (result));
			SendClientMessageToAll(COLOR_YELLOW, string);
			GetPlayerPos(giveplayerid, X, Y, Z);
			CreateExplosion(X, Y, Z, 10, 15.0);
			SetPlayerHealth(giveplayerid, 0);
		}
		else
		{
			format(string, sizeof(string), "\"%s\" was blown-up by Admin \"%s\". Reason: (%s)", giveplayer, sendername, (result));
			SendClientMessageToAll(COLOR_YELLOW, string);
			GetVehiclePos(GetPlayerVehicleID(giveplayerid), X, Y, Z);
			CreateExplosion(X, Y, Z, 4, 10.0);
		}
		return 1;
	}
The only things I fixed on the v-admin are jetpack and godoff :P
Reply
#2

if(giveplayerid != INVALID_PLAYER_ID)

This is telling your script if the given player ID is NOT an Invalid_PLAYER_ID, then give them that message... So change != to ==
Reply
#3

Quote:
Originally Posted by XGh0stz
if(giveplayerid != INVALID_PLAYER_ID)

This is telling your script if the given player ID is NOT an Invalid_PLAYER_ID, then give them that message... So change != to ==
Thanks dude! Now it's working! But when I am trying to explode invalid id then it's doesn't saying that it's invalid. :P But that's ok! Thanks again
Reply
#4

Bleh, instead of using that, just use:
if(!IsPlayerConnected(giveplayerid))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)