Problem with Command -
SpiderWalk - 08.05.2012
Hello everybody.I have problem with command for perk..
code
pawn Код:
CMD:refill(playerid,params[])
{
if(perk[playerid][Ammo] == 1) return SendClientMessage(playerid,0xFFFFFFFF,""embed_red"[ERROR]"embed_grey"You havent choose perk Ammo.Cant use this command!");
SendClientMessage(playerid,0xFFFFFFF,""embed_yellow"[INFO]"embed_white"You have been refill your ammo!");
GivePlayerWeapon(playerid,31,300);
GivePlayerWeapon(playerid,27,50);
GivePlayerWeapon(playerid,24,50);
return 1;
}
I try this solution too
pawn Код:
CMD:refill(playerid,params[])
{
if(perk[playerid][Ammo] == 1) return SendClientMessage(playerid,0xFFFFFFFF,""embed_red"[ERROR]"embed_grey"You havent choose perk Ammo.Cant use this command!");
{
SendClientMessage(playerid,0xFFFFFFF,""embed_yellow"[INFO]"embed_white"You have been refill your ammo!");
GivePlayerWeapon(playerid,31,300);
GivePlayerWeapon(playerid,27,50);
GivePlayerWeapon(playerid,24,50);
}
return 1;
}
But not working
here is Screen shot whats shows in game.
Re: Problem with Command -
2KY - 08.05.2012
pawn Код:
CMD:refill( playerid, params[] )
{
if( perk [ playerid ] [ Ammo ] == 1 )
return SendClientMessage(playerid,0xFFFFFFFF,""embed_red"[ERROR]"embed_grey"You havent choose perk Ammo.Cant use this command!");
else
{
SendClientMessage(playerid,0xFFFFFFF,""embed_yellow"[INFO]"embed_white"You have been refill your ammo!");
GivePlayerWeapon(playerid,31,300);
GivePlayerWeapon(playerid,27,50);
GivePlayerWeapon(playerid,24,50);
}
return true;
}
Re: Problem with Command -
SpiderWalk - 08.05.2012
Still same problem..
Re: Problem with Command - Disturn - 08.05.2012
perk [ playerid ] [ Ammo ] is set to 1. It's the only way your code isn't performing it's task.
pawn Код:
CMD:test(playerid, params[])
{
perk[playerid][Ammo] = 0;
return 1;
}
Call the command test before you refill.
EDIT: After you've tested to see that this is the issue (as obvious as it is), make changes to whatever is needed.
Re: Problem with Command -
DamienWalter - 15.05.2012
Then Try This
Код:
CMD:refill(playerid, params[])
{
if(PlayerInfo[playerid][pJob] != 7 && PlayerInfo[playerid][pJob2] != 7)
{
return SendClientMessageEx(playerid, COLOR_GREY, "You're not a mechanic.");
}
new string[128];
if(PlayerInfo[playerid][pMechTime] >= 1)
{
format(string, sizeof(string), "You must wait %d seconds!", PlayerInfo[playerid][pMechTime]);
return SendClientMessageEx(playerid, COLOR_GRAD1,string);
}
new giveplayerid, money;
if(sscanf(params, "ud", giveplayerid, money)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /refill [playerid] [price]");
if(!(money >= 1 && money < 100000))
{
return SendClientMessageEx(playerid, COLOR_GREY, "Invalid price specified - can't be lower than 1 or higher than $99,999.");
}
if(IsPlayerConnected(giveplayerid))
{
if(ProxDetectorS(8.0, playerid, giveplayerid) && IsPlayerInAnyVehicle(giveplayerid))
{
new Float: fueltogive;
switch(PlayerInfo[playerid][pMechSkill])
{
case 0 .. 49: fueltogive = 10.0;
case 50 .. 99: fueltogive = 20.0;
case 100 .. 199: fueltogive = 30.0;
case 200 .. 399: fueltogive = 40.0;
default: fueltogive = 50.0;
}
if(giveplayerid == playerid)
{
if(PlayerInfo[playerid][pMechSkill] >= 400)
{
new vehicleid = GetPlayerVehicleID(playerid);
VehicleFuel[vehicleid] = VehicleFuel[vehicleid] + fueltogive;
if(VehicleFuel[vehicleid] > 100.0) VehicleFuel[vehicleid] = 100.0;
format(string, sizeof(string), "* %s has refilled their vehicle.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
format(string, sizeof(string), "* You added %.2f fuel to your car.",fueltogive);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
SendClientMessageEx(playerid, COLOR_GREY, "You can't offer a refill to yourself."); return 1;
}
format(string, sizeof(string), "* You offered %s to add %.2f fuel to their car for $%d.",GetPlayerNameEx(giveplayerid),fueltogive,money);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Car Mechanic %s wants to add %.2f fuel to your car for $%d, type /accept refill to accept.",GetPlayerNameEx(playerid),fueltogive,money);
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
PlayerInfo[playerid][pMechTime] = 60;
RefillOffer[giveplayerid] = playerid;
RefillPrice[giveplayerid] = money;
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "That player is not near you, or isn't in a car.");
}
}
else SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
return 1;
}
Re: Problem with Command -
$$inSane - 15.05.2012
use this on connect:
pawn Код:
public OnPlayerConnect(playerid)
{
perk[playerid][ammo] = 0;
return1;
}