Need help with simple command -
MatZZPL - 13.11.2012
hi, i get these errors
Код:
C:\Users\Matt and Amy\Documents\pawno\pawno\Carsystem.pwn(230) : error 017: undefined symbol "text"
C:\Users\Matt and Amy\Documents\pawno\pawno\Carsystem.pwn(239) : error 017: undefined symbol "text"
C:\Users\Matt and Amy\Documents\pawno\pawno\Carsystem.pwn(245) : warning 209: function "zcmd_OnPlayerCommandText" should return a value
C:\Users\Matt and Amy\Documents\pawno\pawno\Carsystem.pwn(267) : error 029: invalid expression, assumed zero
this is the on player command text bit:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(pOffersMechanic[playerid])
{
if(strcmp(text, "Yes", true) == 0)
{
PlayerInfo[playerid][pVeh1tyres1] = 0;
PlayerInfo[playerid][pVeh1doors1] = 0;
PlayerInfo[playerid][pVeh1panels1] = 0;
PlayerInfo[playerid][pVeh1lights1] = 0;
GivePlayerCash(playerid, -amount);
GameTextForPlayer(playerid, "Your car's body work has been fixed", 3000, 3);
}
else if(strcmp(text, "No", true) == 0)
{
GameTextForPlayer(playerid, "Canceled heal offer", 3000, 3);
}
return true;
}
}
and this is the actuall command
Код:
CMD:fixcar(playerid, params[])
{
new giveplayerid,
price,
Float:X, Float:Y, Float:Z;
if(sscanf(params, "di", giveplayerid, price))return SendClientMessage(playerid, -1, "Type: /fixcar (playerid) (amount)");
{
if(!IsPlayerConnected(giveplayerid) || giveplayerid == playerid)
{
SendClientMessage(playerid, -1, "Error: Unable to find this player.");
return true;
}
GetPlayerPos(playerid, X, Y, Z);
if(!IsPlayerInRangeOfPoint(giveplayerid, 5.0, X, Y, Z))
{
SendClientMessage(playerid, -1, "Error: This player is too far from you!");
return true;
}
new vehicleid;
GetPlayerVehicleID(giveplayerid);
if(vehicleid == 0))
{
SendClientMessage(playerid, -1, "Error: This player is not in a vehicle!");
return true;
}
new string[128];
format(string, sizeof(string), "You've received an offer to fix your car for %2.1f", amount);
SendClientMessage(giveplayerid, -1, string);
SendClientMessage(giveplayerid, -1, "Type in the chat \"Yes\" or \"No\" to reply the offer.");
pOffersMechanic[giveplayerid] = true;
price = amount;
GivePlayerCash(playerid, amount);
}
return true;
}
Can anyone help? Ill +rep for any useful answersss
Код:
new bool:pOffersMechanic[MAX_PLAYERS] = false;
new amount;
Re : Need help with simple command -
yusei - 13.11.2012
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(pOffersMechanic[playerid])
{
if(!strcmp(cmdtext, "yes", true))
{
PlayerInfo[playerid][pVeh1tyres1] = 0;
PlayerInfo[playerid][pVeh1doors1] = 0;
PlayerInfo[playerid][pVeh1panels1] = 0;
PlayerInfo[playerid][pVeh1lights1] = 0;
GivePlayerCash(playerid, -amount);
GameTextForPlayer(playerid, "Your car's body work has been fixed", 3000, 3);
return 1;
}
if(!strcmp(cmdtext, "no", true))
{
GameTextForPlayer(playerid, "Canceled heal offer", 3000, 3);
return 1;
}
return 0;
}
}
Re: Need help with simple command -
MatZZPL - 13.11.2012
Thanks mate, just posted it to get it done with quick as possible and you was much quicker, cheers
+rep
Re: Need help with simple command -
MatZZPL - 13.11.2012
The public OnPlayerCommandText(playerid, cmdtext[]) don't really work, when i type in yes or no it doesn't do anything :/
Re : Need help with simple command -
yusei - 13.11.2012
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(pOffersMechanic[playerid])
{
if(strcmp(cmdtext, "yes", true))
{
PlayerInfo[playerid][pVeh1tyres1] = 0;
PlayerInfo[playerid][pVeh1doors1] = 0;
PlayerInfo[playerid][pVeh1panels1] = 0;
PlayerInfo[playerid][pVeh1lights1] = 0;
GivePlayerCash(playerid, -amount);
GameTextForPlayer(playerid, "Your car's body work has been fixed", 3000, 3);
return 1;
}
if(strcmp(cmdtext, "no", true))
{
GameTextForPlayer(playerid, "Canceled heal offer", 3000, 3);
return 1;
}
return 0;
}
}
Ha.. Try this .
Re: Need help with simple command -
MatZZPL - 13.11.2012
Ok 1 sec
Re: Need help with simple command -
tyler12 - 13.11.2012
pawn Код:
public OnPlayerText(playerid, text[])
{
if(pOffersMechanic[playerid])
{
if(strcmp(text, "yes", true))
{
PlayerInfo[playerid][pVeh1tyres1] = 0;
PlayerInfo[playerid][pVeh1doors1] = 0;
PlayerInfo[playerid][pVeh1panels1] = 0;
PlayerInfo[playerid][pVeh1lights1] = 0;
GivePlayerCash(playerid, -amount);
GameTextForPlayer(playerid, "Your car's body work has been fixed", 3000, 3);
return 1;
}
if(strcmp(text, "no", true))
{
GameTextForPlayer(playerid, "Canceled heal offer", 3000, 3);
return 1;
}
}
return 1;
}
Its OnPlayerText..
Re: Need help with simple command -
MatZZPL - 13.11.2012
cheers @tyler12 work, well kinda
Can anyone write me a script? mechanic one where the player (Mechanic) sends and offer for the player and the player has to accept it? My one isn't really working, the player can typein yes and no all the time and fix his car all the time ;/