SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/01/2020, 12:02 PM   #1
AlexUltimate
Little Clucker
 
Join Date: Jan 2020
Posts: 16
Reputation: 0
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
Old 19/01/2020, 03:16 PM   #2
SiaReyes
Huge Clucker
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 414
Reputation: 28
Default Re: Courier Job Problem!

put them in [code] tag or use pastebin.
__________________
Offshowtime Fuck It!

Quote:
Originally Posted by Toroi View Post
blackmail people that join your server using their ip address as hostage

or get a job and play sa-mp for fun
SiaReyes is offline   Reply With Quote
Old 21/01/2020, 03:55 PM   #3
AlexUltimate
Little Clucker
 
Join Date: Jan 2020
Posts: 16
Reputation: 0
Default Re: Courier Job Problem!

more exactly?
AlexUltimate is offline   Reply With Quote
Old 21/01/2020, 06:53 PM   #4
SiaReyes
Huge Clucker
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 414
Reputation: 28
Default Re: Courier Job Problem!

https://pastebin.com/VBBuAwFm

Check out

Edit: Remove OnPlayerSpawn callback since you remove/reset the player from Job in death itself.
__________________
Offshowtime Fuck It!

Quote:
Originally Posted by Toroi View Post
blackmail people that join your server using their ip address as hostage

or get a job and play sa-mp for fun
SiaReyes is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Courier Delivery Job/System! FreAkeD Filterscripts 4 16/12/2017 11:06 AM
My story with Yodel... The Courier iNorton Everything and Nothing 19 05/05/2013 11:18 AM
[FilterScript] Courier Job FS ZackBoolaro Filterscripts 5 27/01/2013 02:21 AM
[FilterScript] Courier Job Mister. M Filterscripts 6 26/04/2011 06:02 PM


All times are GMT. The time now is 04:34 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.