19.01.2012, 22:49
I feel rather noobish posting this here, but I need some help. I am very new to scripting; working on my first (roleplay) gamemode at the moment and I'm stuck on my trucking job.
What the script should do:
The player does the command /starttrucking and they are told to head to the truckers HQ and pickup a truck. A marker at the HQ is set on their mini map. Upon arrival they enter 1 of the 3 trucks and a dialog appears asking them to choose 1 of 3 available drop offs. Depending on which they chose again a marker would be set at their destination. Then they'd head out and when they reached the checkpoint they would receive a certain amount of cash and the truck respawns.
What the script actually does:
The player does the command /starttrucking and they are told to head to the truckers HQ and pick up a truck. A marker at the HQ is set on their mini map. Upon arrival they enter any of the 3 trucks and nothing happens.
Everything compiles fine. I don't know what's up. A friend suggested that switching to Fdialog would fix the issue but I wanted to look for an easier route to take first. If any more information is needed just ask me, thanks for any help!
What the script should do:
The player does the command /starttrucking and they are told to head to the truckers HQ and pickup a truck. A marker at the HQ is set on their mini map. Upon arrival they enter 1 of the 3 trucks and a dialog appears asking them to choose 1 of 3 available drop offs. Depending on which they chose again a marker would be set at their destination. Then they'd head out and when they reached the checkpoint they would receive a certain amount of cash and the truck respawns.
What the script actually does:
The player does the command /starttrucking and they are told to head to the truckers HQ and pick up a truck. A marker at the HQ is set on their mini map. Upon arrival they enter any of the 3 trucks and nothing happens.
Everything compiles fine. I don't know what's up. A friend suggested that switching to Fdialog would fix the issue but I wanted to look for an easier route to take first. If any more information is needed just ask me, thanks for any help!
pawn Код:
// This is a comment
#include <a_samp>
#include <streamer>
#include <sscanf2>
//
#define COLOR_GREEN 0x336633
#define TRUCKINGDIALOG 50
//
new Ccp[MAX_PLAYERS];
//
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Simple Trucking By Devon Berry");
print("--------------------------------------\n");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/starttrucking", true))
{
new string[50];
SendClientMessage(playerid, COLOR_GREEN, "CB Radio: Well, get che' a truck from ol' HQ!");
format(string, sizeof(string), "Head to the Truckers HQ in Dillimore.");
GameTextForPlayer(playerid, string, 3000, 4);
SetPlayerCheckpoint(playerid, 807.3625,-610.1833,16.3359, 3.0);
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new vehicle;
GetPlayerVehicleID(playerid);
if(vehicle == 25)
{
ShowPlayerDialog(playerid, TRUCKINGDIALOG, DIALOG_STYLE_LIST, "Choose a destination.", "From here to LV Depot /*(listitem 0)*/ \nFrom here to Ocean Docks /*(listitem 1)*/ \nFrom here to Verona/*(listitem 2)*/", "Ok", "Cancel Job");
}
else if(vehicle == 26)
{
ShowPlayerDialog(playerid, TRUCKINGDIALOG, DIALOG_STYLE_LIST, "Choose a destination.", "From here to LV Depot /*(listitem 0)*/ \nFrom here to Ocean Docks /*(listitem 1)*/ \nFrom here to Verona/*(listitem 2)*/", "Ok", "Cancel Job");
}
else if(vehicle == 27)
{
ShowPlayerDialog(playerid, TRUCKINGDIALOG, DIALOG_STYLE_LIST, "Choose a destination.", "From here to LV Depot /*(listitem 0)*/ \nFrom here to Ocean Docks /*(listitem 1)*/ \nFrom here to Verona/*(listitem 2)*/", "Ok", "Cancel Job");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 50 || dialogid == TRUCKINGDIALOG)
{
if(!response) return 0;
if(response)
{
if(listitem == 0)
{
Ccp[playerid] = 1;
SetPlayerCheckpoint(playerid, -269.1287,2610.6057,63.2069, 3.0);
SendClientMessage(playerid, COLOR_GREEN, "CB Radio: Well all right, you're gonna' be headin'up north to the LV Depot.");
return 1;
}
if(listitem == 1)
{
Ccp[playerid] = 3;
SetPlayerCheckpoint(playerid, -1051.4005,-655.8729,31.7361, 3.0);
SendClientMessage(playerid, COLOR_GREEN, "CB Radio: This load needs ta' get to the Docks! Speed a bit if you gotta'.");
return 1;
}
if(listitem == 2)
{
Ccp[playerid] = 5;
SetPlayerCheckpoint(playerid, -2286.7529,2282.9390,5.9015, 3.0);
SendClientMessage(playerid, COLOR_GREEN, "CB RADIO: What's it called, ehh, the farm near Verona Beach, get there'!");
return 1;
}
}
}
return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
DisablePlayerCheckpoint(playerid);
SendClientMessage(playerid, COLOR_GREEN, "CB Radio: Eh, you've made it. Choose a truck, and then head to yer' destination.");
if(Ccp[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
Ccp[playerid] = 2;
SetVehicleToRespawn(1);
GivePlayerMoney(playerid, 5000);
return 1;
}
if(Ccp[playerid] == 2)
{
DisablePlayerCheckpoint(playerid);
Ccp[playerid] = 0;
SetVehicleToRespawn(1);
GivePlayerMoney(playerid, 10000);
return 1;
}
if(Ccp[playerid] == 3)
{
DisablePlayerCheckpoint(playerid);
Ccp[playerid] = 4;
SetVehicleToRespawn(1);
GivePlayerMoney(playerid, 7500);
return 1;
}
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}