09.08.2009, 17:20
I have this explsion command (/explosion):
HH = Player health after explosion
but i dont know where to put GetPlayerHealth(otherplayer, HH);
if before the CreateExplosion --> will probadly(is it how you spell it?) it will show the life before the explosion
if after CreateExplosion--> it will maybe do a random number / life before explosion
so where to put GetPlayerHealth(otherplayer, HH); so it will work?
tanks for helpers
pawn Код:
if(strcmp(cmd, "/explode", true) == 0)
{
if (!IsPlayerAdmin(playerid)) return 0;
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /explode [playerid/PartOfName] [reason]");
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "This command is exploding a player");
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "It creats an explosion on a player");
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "Its helping to find cheaters,and just explode for fun");
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "Warn!- also people around the player that exploded will hurt too!");
if(giveplayerid != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Warning!: Wrong ID/Player is not connected");
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]");
if(!strlen(result)) return SendClientMessage(playerid, COLOR_GRAD2, "This command is exploding a player");
if(!strlen(result)) return SendClientMessage(playerid, COLOR_GRAD2, "It creats an explosion on a player");
if(!strlen(result)) return SendClientMessage(playerid, COLOR_GRAD2, "Its helping to find cheaters,and just explode for fun");
if(!strlen(result)) return SendClientMessage(playerid, COLOR_GRAD2, "Warn!- also people around the player that exploded will hurt too!");
new Float:HH;
new Float:X,Float:Y,Float:Z;
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessageToAll(playerid, COLOR_YELLOW, string,"You have been explode %s(ID:%d)! %s has %d health remaning!", giveplayer, sendername, (result), HH);
GetPlayerPos(giveplayerid, X, Y, Z);
CreateExplosion(X, Y, Z, 10, 15.0);
}
else
{
SendClientMessageToAll(playerid, COLOR_YELLOW, string,"You have been explode %s(ID:%d)! %s has %d health remaning!", giveplayer, sendername, (result), HH);
GetVehiclePos(GetPlayerVehicleID(giveplayerid), X, Y, Z);
CreateExplosion(X, Y, Z, 4, 10.0);
}
return 1;
}
but i dont know where to put GetPlayerHealth(otherplayer, HH);
if before the CreateExplosion --> will probadly(is it how you spell it?) it will show the life before the explosion
if after CreateExplosion--> it will maybe do a random number / life before explosion
so where to put GetPlayerHealth(otherplayer, HH); so it will work?
tanks for helpers