PDA

View Full Version : Script Conversion


RedbullGD
04/05/2014, 01:56 PM
Hey guys.Hope everything's fine.
First of all let me tell u i'm really new at scripting that's why i need another help.
I want u guys to please convert zcmd to strcmp.
Here is my script.


#include <a_samp>
#include <zcmd>

#define red 0xFF0000AA
#define green 0x33FF33AA

new GodMode[MAX_PLAYERS];
new Float:hp[MAX_PLAYERS];
new Float:armour[MAX_PLAYERS];
new Moneys[MAX_PLAYERS]; // above armour for example

CMD:godmode(playerid, params[])
{

if(GodMode[playerid] == 0)
{

Moneys[playerid] = GetPlayerMoney(playerid);
ResetPlayerMoney(playerid);
ResetPlayerWeapons(playerid);
GodMode[playerid] = 1;
SetPlayerHealth(playerid, 99999);
SetPlayerArmour(playerid, 99999);
SetVehicleHealth(GetPlayerVehicleID(playerid),9999 999999);
GetPlayerHealth(playerid,hp[playerid]);
GetPlayerArmour(playerid,armour[playerid]);
SendClientMessage(playerid,green, "|---------------------|");
SendClientMessage(playerid,green, "|-God-Mode-On-|");
SendClientMessage(playerid,green, "|---------------------|");
}
else if(GodMode[playerid] == 1)
{
GivePlayerWeapon(playerid,29,150);
GivePlayerMoney(playerid,Moneys[playerid]);
GodMode[playerid] = 0;
SetPlayerHealth(playerid,hp[playerid]);
SetPlayerArmour(playerid,armour[playerid]);
SetVehicleHealth(GetPlayerVehicleID(playerid),1250 .0);
SendClientMessage(playerid,red, "|---------------------|");
SendClientMessage(playerid,red, "|-God-Mode-Off-|");
SendClientMessage(playerid,red, "|---------------------|");
}


return 1;
}


Thanks in advance.

Rockyyy
04/05/2014, 02:00 PM
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/godmode", cmdtext, true, 10) == 0)
{
if(GodMode[playerid] == 0)
{
Moneys[playerid] = GetPlayerMoney(playerid);
ResetPlayerMoney(playerid);
ResetPlayerWeapons(playerid);
GodMode[playerid] = 1;
SetPlayerHealth(playerid, 99999);
SetPlayerArmour(playerid, 99999);
SetVehicleHealth(GetPlayerVehicleID(playerid),9999 999999);
GetPlayerHealth(playerid,hp[playerid]);
GetPlayerArmour(playerid,armour[playerid]);
SendClientMessage(playerid,green, "|---------------------|");
SendClientMessage(playerid,green, "|-God-Mode-On-|");
SendClientMessage(playerid,green, "|---------------------|");
}
else if(GodMode[playerid] == 1)
{
GivePlayerWeapon(playerid,29,150);
GivePlayerMoney(playerid,Moneys[playerid]);
GodMode[playerid] = 0;
SetPlayerHealth(playerid,hp[playerid]);
SetPlayerArmour(playerid,armour[playerid]);
SetVehicleHealth(GetPlayerVehicleID(playerid),1250 .0);
SendClientMessage(playerid,red, "|---------------------|");
SendClientMessage(playerid,red, "|-God-Mode-Off-|");
SendClientMessage(playerid,red, "|---------------------|");
}
return 1;
}
return 0;
}

RedbullGD
04/05/2014, 02:07 PM
Rocky thank you rep++

Mellnik
04/05/2014, 02:20 PM
ye rather upgrade to ycmd which has some neat functions