20.11.2011, 11:18
Thank you,you helped alot rep+
if(PlayerInfo[playerid][pLider] == 1 || PlayerInfo[playerid][pMember] == 1) { if(PlayerInfo[playerid][pRank] == 1) { RankText = "Rokie"; } else if(PlayerInfo[playerid][pRank] == 2) { RankText = "Captain"; } } else if(PlayerInfo[playerid][pLider] == 2 || PlayerInfo[playerid][pMember] == 2) { if(PlayerInfo[playerid][pRank] == 1) { RankText = "Gangsa"; } else if(PlayerInfo[playerid][pRank] == 2) { RankText = "Capo"; } }
if(PlayerInfo[playerid][pLider] == 1 || PlayerInfo[playerid][pMember] == 1)
{
if(PlayerInfo[playerid][pRank == 1) RankText[playerid] = "Rokie";
else if(PlayerInfo[playerid][pRank] == 2) RankText[playerid] = "Captain";
}
else if(PlayerInfo[playerid][pLider] == 2 || PlayerInfo[playerid][pMember] == 2)
{
if(PlayerInfo[playerid][pRank] == 1) RankText[playerid] = "Gangsa";
else if(PlayerInfo[playerid][pRank] == 2) RankText[playerid] = "Capo";
}
Originally Posted by '[HLF
pawn Code:
|
[Test]Noob = Noob;
No[Test]ob = Noob;
Noob[Test] = Noob;
stock RemoveTags(name[])
{
new i, len = strlen(name), fpos = -1, lpos = -1;
for (i = 0; i < len; i++)
{
if (name[i] == '[')
{
fpos = i;
}
else if (name[i] == ']')
{
lpos = i;
}
}
if ( fpos == -1 || lpos == -1 ) return name;
strdel(name, fpos, lpos);
return name;
}
#include <a_samp>
#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
new TruckerJob[256];
public OnFilterScriptInit()
{
AddStaticVehicle(403,2057.3081,-1939.9397,13.9432,270.4501,6,6); // Truck (Spawn Front)
AddStaticVehicle(591,2045.2939,-1939.9041,13.0633,268.2366,6,6); // Trailer (Spawn Back)
AddStaticVehicle(403,2032.4635,-1939.7537,13.9389,271.0817,6,6); // Truck (Spawn Front)
AddStaticVehicle(591,2020.9797,-1940.1196,13.9476,270.5276,6,6); // Trailer (Spawn Back)
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/job trucker", cmdtext, true, 10) == 0)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 403)
{
if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))){ SendClientMessage(playerid,COLOR_RED,"* You don't have a trailer attached to the vehicle!"); return 1; }
if(TruckerJob[playerid] != 1 && TruckerJob[playerid] != 2 && TruckerJob[playerid] != 3){ TruckerJob[playerid] = 1; }
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "* %s is now a Trucker.", name );
SendClientMessageToAll(COLOR_YELLOW, string);
// TRUCKER JOB #1
if(TruckerJob[playerid] == 1){
TruckerJob[playerid] = 2;
SetPlayerCheckpoint(playerid,1337.8055,-870.5533,39.3027,10);
SendClientMessage(playerid, COLOR_RED, "Deliver food supplies to Roboi's Food Mart");
return 1;
}
// TRUCKER JOB #2
if(TruckerJob[playerid] == 2){
TruckerJob[playerid] = 3;
SetPlayerCheckpoint(playerid,1003.4263,-941.8485,41.8079,10);
return 1;
}
// TRUCKER JOB #3
if(TruckerJob[playerid] == 3){
TruckerJob[playerid] = 1;
SetPlayerCheckpoint(playerid,-97.8173,-1166.7585,2.2650,10);
return 1;
}
return 1;
}
SendClientMessage(playerid, COLOR_RED,"You have to be in a Truck cab to start the job");
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 403)
{
SendClientMessage(playerid, COLOR_RED, "* You can start Trucking by typing /job trucker");
}
return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 403)
{
if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))){ SendClientMessage(playerid,COLOR_RED,"* You don't have a trailer attached to the vehicle!"); DisablePlayerCheckpoint(playerid); return 1; }
GivePlayerMoney(playerid,500);
SendClientMessage(playerid,COLOR_YELLOW,"* You have earned $500!");
DisablePlayerCheckpoint(playerid);
}
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(TruckerJob[playerid] > 0)
{
SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
DisablePlayerCheckpoint(playerid);
}
}
1) Look up "random()".
2) "IsTrailerAttachedToVehicle" will tell you if a vehicle has a trailer. To detect when it comes off you just need to call that function repeatedly, either in a timer or "OnPlayerUpdate". 3) Not sure. 4) Move the activiation code out of "OnPlayerCommandText" in to a new function then call that function from both "OnPlayerCommandText" with a random number to begin one, and from "OnPlayerEnterCheckpoint" with the next number to continue when they complete the current one. I know it's not in-depth help, but hopefully useful pointers. |