native SetPlayerCash(playerid, cash);
//Description - Sets the player's cash
native RemovePlayerCash(playerid, cash);
//Description - Removes the player's cash.Don't type -cash i.e RemovePlayerCash(playerid, -1000) just write RemovePlayerCash(playerid, 1000);
native GivePlayerScore(playerid, score);
//Description - Gives Player Score
native RemovePlayerScore(playerid, score);
//Description - Removes the player's score.Don't type -score i.e RemovePlayerScore(playerid, -1000) just write RemovePlayerScore(playerid, 1000);
native GetVehicleIDByName(name[]);
//Description - Gets the ID of the vehicle by it's name
native GetWeaponIDByName(name[]);
//Description - Gets the ID of the weapon by it's name
native GetVehicleNameByModel(model);
//Description - Gets the name of the vehicle by it's ID
native GetWeaponNameByID(id);
//Description - Gets the name of the weapon by it's ID
native GetPlayerNameEx(playerid);
//Description - A much better way to Get the player's name
native SetPlayerPosEx(playerid, Float:x ,Float:y,Float:z,Angle,interior,VirtualWorld);
//Description - Sets the players position.Interior and Virtual World are optional parameters.
native KickAll();
//Description - Self Explanatory
native BanAll();
//Description - Self Explanatory
native FreezeAll();
//Description - Self Explanatory
native UnfreezeAll();
//Description - Self Explanatory
native Freeze(playerid);
//Description - Self Explanatory
native Unfreeze(playerid);
//Description - Self Explanatory
native GetPlayerIPEx(playerid);
//Description - Gets a player's IP
native Explode(playerid);
//Description - Self Explanatory
native ExplodeAll();
//Description - Self Explanatory
native Kill(playerid);
//Description - Self Explanatory
native KillAll();
//Description - Self Explanatory
native ShowMessage(playerid, caption[], info[]);
//Description - Shows a Message Box
public OnPlayerEnterWater(playerid)//Is called when a player enters water.
if(!strcmp(cmdtext, "/cash", true))
{
SetPlayerCash(playerid, 10000);
return 1;
}
if(!strcmp(cmdtext, "/nocash", true))
{
RemovePlayerCash(playerid, 10000);
return 1;
}
if(!strcmp(cmdtext, "/score", true))
{
GivePlayerScore(playerid, 100);
return 1;
}
if(!strcmp(cmdtext, "/noscore", true))
{
RemovePlayerScore(playerid, 50);
return 1;
}
if(!strcmp(cmdtext, "/car", true))
{
new vehicle = GetVehicleIdByName(params); //converts the vehiclename to modelID
if(vehicle == -1) return SendClientMessage(playerid,-1,"Invalid vehicle name!");
new Float:pos[3];GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
CreateVehicle(vehicle,pos[0],pos[1],pos[2]);
return 1;
}
if(!strcmp(cmdtext, "/weapon", true))
{
new weapon = GetWeaponIdByName(params); //converts the weaponname to weaponmodel
if(weapon == -1) return SendClientMessage(playerid,-1,"Invalid weapon name!");
GivePlayerWeapon(playerid,weapon,100);
return 1;
}
if(!strcmp(cmdtext, "/vehiclename", true))
{
new vehicle = GetVehicleNameByModel(432);
new string[125];
format(string, sizeof(string), "You are currently sitting in a %s", vehicle);
SendClientMessage(playerid, -1, string);
return 1;
}
if(!strcmp(cmdtext, "/weaponname", true))
{
new weapon = GetWeaponNameByID(2);
new string[125];
format(string, sizeof(string), "You currently have a %s in hand", weapon);
SendClientMessage(playerid, -1, string);
return 1;
}
if(!strcmp(cmdtext, "/name", true))
{
new string[125];
format(string, sizeof(string), "Your name is %s", GetPlayerNameEx(playerid));
SendClientMessage(playerid, -1, string);
return 1;
}
if(!strcmp(cmdtext, "/pos", true))
{
SetPlayerPosEx(playerid, 0.0, 0.0, 0.0, 0, 0, 1);
return 1;
}
if(!strcmp(cmdtext, "/kickall", true))
{
KickAll();
return 1;
}
if(!strcmp(cmdtext, "/banall", true))
{
BanAll();
return 1;
}
if(!strcmp(cmdtext, "/freezeall", true))
{
FreezeAll();
return 1;
}
if(!strcmp(cmdtext, "/unfreezeall", true))
{
UnfreezeAll();
return 1;
}
if(!strcmp(cmdtext, "/freeze", true))
{
Freeze(playerid);
return 1;
}
if(!strcmp(cmdtext, "/unfreeze", true))
{
Unfreeze(playerid);
return 1;
}
if(!strcmp(cmdtext, "/myip", true))
{
new ip = GetPlayerIPEx(playerid);
new string[125];
format(string, sizeof(string), "Your ip is %d", ip);
SendClientMessage(playeridm -1, string);
return 1;
}
if(!strcmp(cmdtext, "/boom", true))
{
Explode(playerid);
return 1;
}
if(!strcmp(cmdtext, "/bigbang", true))
{
ExplodeAll();
return 1;
}
if(!strcmp(cmdtext, "/kill", true))
{
Kill();
return 1;
}
if(!strcmp(cmdtext, "/killall", true))
{
KillAll();
return 1;
}
if(!strcmp(cmdtext, "/hi", true))
{
ShowMessage(playerid, "Hello", "Hello");
return 1;
}
public OnPlayerEnterWater(playerid)
{
//Your Code Here
return 1;
}
if(!strcmp(cmdtext, "/killall", true))
{
KillAll;
return 1;
}
if(!strcmp(cmdtext, "/vehiclename", true))
{
new vehicle = GetVehicleNameByModel(432);
new string[125];
format(string, sizeof(string), "You are currently sitting in a %s", vehicle);
SendClientMessage(playerid, -1, string);
return 1;
}
stock ExplodeAll()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(i, X, Y, Z);
CreateExplosion(X, Y, Z, 7, 100.0);
}
}
stock ExplodeAll()
{
new Float:X, Float:Y, Float:Z;
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, X, Y, Z);
CreateExplosion(X, Y, Z, 7, 100.0);
}
}
pawn Код:
Function can't be writen like that(KickAll. You must use brackets (). As for the vehicle name, you're storring it's name in to an integer. |
Don't create variables inside a loop.
Bad: pawn Код:
pawn Код:
|
stock ExplodeAll()
{
new Float:X, Float:Y, Float:Z;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, X, Y, Z);
CreateExplosion(X, Y, Z, 7, 100.0);
}
}
}
pawn Code:
|
Why post a function without an explanation?
Theres no problem with it. I was referring to the other loops in the include. |
Sorry thought i added something to the code i posted..
I added a check to see if the player you're exploding is connected |