20.04.2012, 14:34
WTF! man add the commands under public
pawn Code:
OnPlayerCommandText( playerid, cmdtext[ ] )
pawn Code:
//top of script
#include <a_samp>
new LoadCount[MAX_PLAYERS] = 0;
//commands
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
if( strcmp( cmdtext, "/work", true ) == 0 )
{
if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 519 &&
GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 592 &&
GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 577 )
return SendClientMessage( playerid, 0xFFFFFFFF, "Yor Need to be In A Vehicle to Do work!" );
SetPlayerCheckpoint( playerid, 1644.4673, -2416.9844, 13.5547, 15.0 );
LoadCount[playerid] = 0; // we restart variable
return 1;
}
if( strcmp( cmdtext, "/stopwork", true ) == 0 )
{
if(GetPlayerMoney(playerid) >= 1000)
{
DisablePlayerCheckpoint( playerid );
SendClientMessage(playerid,0xFFFFFFFFF,"You Have Canceled the Work!");
GivePlayerMoney(playerid,-1000); //take $1'000 from him
LoadCount[playerid] = 0; //we restart variable
}
else
{
SendClientMessage(playerid,0xFFFFFFFFF,"You Need $1000 to Cancel the Work!");
}
return 1;
}
return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
LoadCount[playerid]++; //we add one count to his done works
switch(LoadCount[playerid])
{
case 1: //if he did one load
{
SetPlayerCheckpoint(playerid, 1577.2006,1504.4862,10.8342,328.6342); //this is second CP
}
case 2: // if he did 2 loads
{
LoadCount[playerid] = 0; //we return count to 0
// rest of your code here when he finishes 2 loads
}
}
return 1;
}