14.03.2012, 18:34
i made 3 cmds..but i type for /refill and /repair and it says.. You are not a Car Mechanic and i made myself car mechanic..No errors
i put /tc and nothing happens../tc is for chating with other mechanics..only mechanics giving rep to all
PHP код:
if(strcmp(cmd, "/refill", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Car Mechanic!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /refill [playerid/PartOfName] [price]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if(money < 1 || money > 2000) { SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1, or above 2000!"); return 1; }
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
{
if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, " Can't do that!"); return 1; }
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You offerd %s to refill his car for $%d .",giveplayer,money);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Car Mechanic %s wants to refill your car for $%d, (type /accept refill) to accept.",sendername,money);
SendClientMessage(playa, COLOR_LIGHTBLUE, string);
RefillOffer[playa] = playerid;
RefillPrice[playa] = money;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you / not in a car.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is offline.");
}
}
return 1;
}
if(strcmp(cmd, "/repair", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Car Mechanic!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /repair [playerid/PartOfName] [price]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if(money < 1 || money > 2000) { SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1, or above 2000!"); return 1; }
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
{
if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, " Can't do that!"); return 1; }
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You offerd %s to fix his car for $%d .",giveplayer,money);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Car Mechanic %s wants to repair your car for $%d, (type /accept repair) to accept.",sendername,money);
SendClientMessage(playa, COLOR_LIGHTBLUE, string);
RepairOffer[playa] = playerid;
RepairPrice[playa] = money;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you / not in a car.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is offline.");
}
}
return 1;
}
PHP код:
if(strcmp(cmd, "/tc", true) == 0)
{
if(IsPlayerConnected(playerid))
{
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;
result[0] = toupper(result[0]);
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/tc)[TC chat]");
return 1;
}
if(PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)
{
if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Patron %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Under-Boss %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Manager %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Senior-Mechanic %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Mechanic %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Vulcanizator %s: %s, over. **", sendername, result); }
else
{
format(string, sizeof(string), "** Vulcanizator %s: %s, over. **", sendername, result);
}
SendRadioMessage(1, TEAM_SEA_COLOR, string);
printf("%s", string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Nu faceti parte de TCC !");
return 1;
}
}
return 1;
}