Help !
#1

I would like to make a FS for taxi job with those :
1
Код:
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
if(strcmp(cmd, "/startfare", true) == 0 || strcmp(cmd, "/fare", true) == 0)
{
if (PlayerInfo[playerid][pFaction] == 3)
{
new taxi = GetPlayerVehicleID(playerid);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /startfare [playerID]");
return 1;
}
if(IsStringAName(tmp))
{
giveplayerid = GetPlayerID(tmp);
}
else
{
giveplayerid = strval(tmp);
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(!IsATaxi(taxi))
{
SendClientMessage(playerid, COLOR_GRAD2, "Your not in a taxi!");
return 1;
}
if(fared[giveplayerid]!=255)
{
SendClientMessage(playerid, COLOR_GRAD2, "They are already being fared!");
return 1;
}
if(GetPlayerVehicleID(giveplayerid) == taxi)
{
format(string, sizeof(string), "You started a fare on %s, /stopfare /eject or let them leave to stop it",giveplayer);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "%s started a fare of $1 per second, leave the vehicle to stop the fare",sendername);
SendClientMessage(giveplayerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~W~Fare: ~R~$%d",fare[playerid]);
GameTextForPlayer(giveplayerid, string, 50000, 3);
fared[giveplayerid] = playerid;
fare[giveplayerid] = 0;
taxirequest[giveplayerid] = 0;
format(string, sizeof(string), "%s has begun a fare on %s",sendername, giveplayer);
SendJobMessage(COLOR_YELLOW, 1, string);
return 1;
}
}
return 1;
}
//-------------------------[End Fare]---------------------------------------------
if(strcmp(cmd, "/endfare", true) == 0 || strcmp(cmd, "/stopfare", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /endfare [playerID]");
return 1;
}
giveplayerid = strval(tmp);
if (PlayerInfo[playerid][pFaction] != 3)
{
SendClientMessage(playerid, COLOR_GRAD2, "Your not a taxi driver!");
return 1;
}
if(!IsATaxi(GetPlayerVehicleID(playerid)))
{
SendClientMessage(playerid, COLOR_GRAD2, "Your not in a taxi!");
return 1;
}
if(fared[giveplayerid] != playerid)
{
SendClientMessage(playerid, COLOR_GRAD2, "You aren't faring that person!");
return 1;
}
format(string, sizeof(string), "You collected %d from this fare, it was added to your paycheck", fare[giveplayerid]);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "You payed %d for the journey", fare[giveplayerid]);
SendClientMessage(giveplayerid, TEAM_GROVE_COLOR, string);
PlayerInfo[playerid][pPaycheck] += fare[giveplayerid];
AntiHack(giveplayerid, -fare[giveplayerid]);
fared[giveplayerid] = 255;
return 1;
}
2
Код:
//-------------------------[Duty]-----------------------------------------------
if(strcmp(cmd, "/duty", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(gTeam[playerid] != 2 && PlayerInfo[playerid][pJob] != 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "You are neither a Cop nor a Taxi Driver!");
return 1;
}
if (PlayerInfo[playerid][pJob] == 1)
{
if (IsATaxi(GetPlayerVehicleID(playerid)))
{
if(TDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREEN, "Taxi: You are now off duty!");
TDuty[playerid] = 0;
return 1;
}
if(GetTickCount() - TDutyT[playerid] < 60000)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You can only go on duty once a minute!");
return 1;
}
TDuty[playerid] = 1;
TDutyT[playerid] = GetTickCount();
format(string, sizeof(string), "TAXI: Taxi Driver %s is now on duty, /call 555 for a Taxi", sendername);
SendClientMessageToAll(COLOR_GREEN, string);
printf("%s", string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "You are not in the Taxi Compound");
return 1;
}
}
Thanks !
Reply
#2

Pre-define everything and put some crazy spamtardy shit together and see if it compiles.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)