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;
}
Originally Posted by WrathOfGenesis
Ok, from what i can see, that script wont work.
What do you want it to do exactly? |
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!");
SendClientMessageToAll(playerid, COLOR_YELLOW, string,"You have been explode %s(ID:%d)! %s has %d health remaning!", giveplayer, sendername, (result), HH);
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(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);
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;
}
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");
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(!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); }
SendClientMessageToAll(playerid, COLOR_YELLOW, string,"You have been explode %s(ID:%d)! %s has %d health remaning!", giveplayer, sendername, (result), HH);
new Float:HH;
Originally Posted by Woet
Please correct your code so it works, is clean and makes sense, then I'll tell you where to put GetPlayerHealth.
|
if(strcmp(cmd, "/explode", true) == 0)
{
if (!IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_GRAD2, "You must be an admin to use this command!");
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
if(!strlen(tmp)) SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /explode [playerid/PartOfName] [reason]");
if(!strlen(tmp)) SendClientMessage(playerid, COLOR_GRAD2, "This command is exploding a player");
if(!strlen(tmp)) SendClientMessage(playerid, COLOR_GRAD2, "It creats an explosion on a player");
if(!strlen(tmp)) SendClientMessage(playerid, COLOR_GRAD2, "Its helping to find cheaters,and just explode for fun");
if(!strlen(tmp)) SendClientMessage(playerid, COLOR_GRAD2, "Warn!- also people around the player that exploded will hurt too!");
if(giveplayerid= INVALID_PLAYER_ID) 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);
if(!strlen(result)) SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /explode [playerid/PartOfName] [reason]");
if(!strlen(result)) SendClientMessage(playerid, COLOR_GRAD2, "This command is exploding a player");
if(!strlen(result)) SendClientMessage(playerid, COLOR_GRAD2, "It creats an explosion on a player");
if(!strlen(result)) SendClientMessage(playerid, COLOR_GRAD2, "Its helping to find cheaters,and just explode for fun");
if(!strlen(result)) 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;
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);
}
return 1;
}