View Single Post
Old 19/01/2020, 11:02 AM   #1
AlexUltimate
Little Clucker
 
Join Date: Jan 2020
Posts: 30
Reputation: 2
Default Courier Job Problem!

Hello! I scripted this job and when I go to the server to test it doesn't work! Type / startwork and nothing. I don't get any error or warning! Forget the whole script!
Ignore that bonus system
This is script:

#include <a_samp>
#include <zcmd>
#include <streamer>
#include <sscanf2>
#include <string>

#define JOB_NAME1 "Courier"
#define JOB_VEHICLE1 456
new PlayerJob[MAX_PLAYERS];
new JobCp[MAX_PLAYERS];
new JobVehicle[MAX_PLAYERS];
new JobWorking[MAX_PLAYERS];

#if defined filescripts

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" BETA MOMENTAN!");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{

///////////////////////////// TEXTE////////////////////////
//ai ramas la minutul 16:35////////


////////////////////////////Obiecte////////////////////////

CreateObject(19055, -2731.95459, -306.40820, 6.79880, 0.00000, 0.00000, -49.62000);

////////////////////////////CARS/////////////////////

CreateVehicle(402, -2735.8835, -295.5635, 6.6630, 49.0800, -1, -1, 100);
CreateVehicle(495, -2739.5168, -298.3458, 7.0660, 51.9000, -1, -1, 100);
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(20,-2720.1111,-318.4988,7.8438,44.3591,0,0,0,0,0,0);
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerConnect(playerid)
{
JobVehicle[playerid] = 0;
JobCp[playerid] = 0;
PlayerJob[playerid] = 0;
JobWorking[playerid] = 0;
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
if(JobWorking[playerid] == 1)
FailJob(playerid, "Deconectare");
return 1;
}

public OnPlayerSpawn(playerid)
{
if(JobWorking[playerid] == 1)
FailJob(playerid, "Ai fost respawnat !");
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
if(JobWorking[playerid] == 1)
FailJob(playerid, "Ai murit!");
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/getjob", cmdtext, true, 10) == 0)
{
if(PlayerJob[playerid] != 0) return SendClientMessage(playerid, 0x06FFB3FF, "Ai deja un job!");
new string[256];
if(IsPlayerInRangeOfPoint(playerid, 5.0,-2788.1003, -295.5852, 6.352) {
PlayerJob[playerid] = 1;
format(string, sizeof(string), "Noul tau job este %s. Folosete comanda /startwork pentru a incepe munca!", JOB_NAME1);
SendClientMessage(playerid,0x07B2F7FF, string);
}
else SendClientMessage(playerid, 0xF60202FF, "Nu esti in zona unui job!");

return 1;
}
if (strcmp("/quitjob", cmdtext, true, 10) == 0)
{
if(PlayerJob[playerid] != 0) return SendClientMessage(playerid, 0xD20F2DFF, "Nu ai un job!");
if(JobWorking[playerid] == 1) FailJob(playerid, "Ai renuntat la job!");
PlayerJob[playerid] = 0;
SendClientMessage(playerid, 0x0F0FD2FF, "Ti-ai dat demisia!");
return 1;
}
if (strcmp("/startwork", cmdtext, true, 10) == 0)
{
if(PlayerJob[playerid] != 0) return SendClientMessage(playerid, 0xD20F2DFF, "Nu ai un job!");
switch (PlayerJob[playerid]) {
case 1: {
if(!IsPlayerInRangeOfPoint(playerid, 5.0, -2783.9023, -281.8239, 6.2069)) {
SendClientMessage(playerid, 0x0AE498FF, "Nu esti in locatia potrivita!");
SetPlayerCheckpoint(playerid, -2783.9023, -281.8239, 6.2069, 7.0);
JobCp[playerid] = 1;
return 1;
}
JobVehicle[playerid] = CreateVehicle(456, -2781.1589, -282.0042, 6.9304, 0.0000, -1, -1, 100);
PutPlayerInVehicle(playerid, JOB_VEHICLE1, 0);
JobWorking[playerid] = 1;
JobCp[playerid] = 2;
SetPlayerCheckpoint(playerid, -2780.6438, -320.0563, 6.1670, 7.0);
}


}
return 1;
}

return 0;
}
forward FailJob(playerid, reason []);
public FailJob(playerid, reason [])
{
new string[256];
format(string, sizeof(string), "Munca ta a esuat! Motiv %s,", reason);
SendClientMessage(playerid, 0x521111FF, string);
DestroyVehicle(JobVehicle[playerid]);
JobVehicle[playerid] = 0;
JobWorking[playerid] = 0;
DisablePlayerCheckpoint(playerid);
JobCp[playerid] = 0;

return 1;

}
forward FinalJob(playerid);
public FinalJob(playerid)
{

DestroyVehicle(JobVehicle[playerid]);
JobVehicle[playerid] = 0;
JobWorking[playerid] = 0;
DisablePlayerCheckpoint(playerid);
JobCp[playerid] = 0;

return 1;

}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_ONFOOT)
{
FailJob(playerid, "Deoarece te-ai dat jos din masina,job-ul a esuat!");
}
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
new string[256];
switch(JobCp[playerid]) {
case 1: {
DisablePlayerCheckpoint(playerid);
JobCp[playerid] = 0;
SendClientMessage(playerid, 0xE4810AFF, "Acum poti tasta /startwork!");
}
case 2: SetPlayerCheckpoint(playerid, -2787.7009, -326.3154, 6.1146, 7.0), JobCp[playerid] ++;
case 3: SetPlayerCheckpoint(playerid, -0.8400, -17.5200, 3.5400, 7.0), JobCp[playerid] ++;
case 4: SetPlayerCheckpoint(playerid, -1858.0089, 1398.5632, 6.3920, 7.0), JobCp[playerid] ++;
case 5: SetPlayerCheckpoint(playerid, -1523.4014, 495.0647, 6.4082, 7.0), JobCp[playerid] ++;
case 6: SetPlayerCheckpoint(playerid, -2126.6016, 208.5466, 34.5315, 7.0), JobCp[playerid] ++;
case 7: SetPlayerCheckpoint(playerid, -2780.6438, -320.0563, 6.1670, 7.0), JobCp[playerid] ++;
case 8: {

DisablePlayerCheckpoint(playerid);
new money = 25000 + random(20000);
format(string, sizeof(string), "Ai terminat munca si ai primit $%d !", money);
SendClientMessage(playerid, 0x0F59DAFF, string);
GivePlayerMoney(playerid, money);
FinalJob(playerid);
}
}

return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}


stock GetName(playerid) {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}


CMD:bonus(playerid, params[]) {

if(!IsPlayerInRangeOfPoint(playerid, 5.0,-2731.1892,-306.7589,7.1875)) return SendClientMessage(playerid, 0x919191FF, "Nu esti unde trebuie!");
new string[128], rand = 100000 + random(100000);
format(string, sizeof(string),"Felicitari, %s! Ai castigat $%d", GetName(playerid), rand);
SendClientMessage(playerid, 0x99FFFF,string);
GivePlayerMoney(playerid, rand);
return 1;
}
AlexUltimate is offline   Reply With Quote