[FilterScript] Streetcleaner (After 2 minutes driving you'll be payed) -
Mister. M - 14.04.2011
Hello World!
I just created a script, its very very easy to create but just if somebody is searching for one, here it is!
<^ Thanks the IsASweeper Function from Raven's Roleplay ^>
----
Colors:
----
pawn Код:
#define COLOR_RED 0xAA3333AA
#define COLOR_ORANGE 0xFF9900AA
----
The top:
----
pawn Код:
new PlayerIsSweeping[MAX_PLAYERS];
new idcar = GetPlayerVehicleID(playerid);
--
OnPlayerExitVehicle
--
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(IsASweeper(vehicleid)){
if(PlayerIsSweeping[playerid] == 1){
SendClientMessage(playerid,COLOR_RED,"You have left your job, you won't recieve the money!");
PlayerIsSweeping[playerid] = 0;
return 1;
}
}
}
---
OnPlayerEnterVehicle
---
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsASweeper(vehicleid)){ SendClientMessage(playerid,COLOR_ORANGE,"You can start the job using /takejob"); return 1; }
}
---
IsASweeper * Thanks to Raven's Roleplay
---
pawn Код:
public IsASweeper(carid)
{
new model = GetVehicleModel(carid);
if(model == 574)
{
return 1;
}
return 0;
}
---
The Command;
---
pawn Код:
if(!strcmp(cmdtext, "/takejob", true))
{
if(IsPlayerConnected(playerid))
{
if(IsASweeper(idcar)) {
if(PlayerIsSweeping[playerid] == 1)
{ SendClientMessage(playerid, COLOR_BLUE, "You are already sweeping the streets!"); return 1; }
new giveplayerid[128];
new string[128];
new plname[128];
SetTimerEx("Payhim", 120000, false, "i", playerid);
PlayerIsSweeping[playerid] = 1;
TogglePlayerControllable(playerid, 1);
GetPlayerName(playerid, plname, sizeof(plname));
SendClientMessage(playerid, COLOR_WHITE, "* You will recieve $400 for cleaning the streets after 2 minutes!");
format(string, sizeof(string), "* %s (%d) is now a Streetcleaner!", plname, playerid);
SendClientMessageToAll(COLOR_YELLOW, string);
}
return 1;
}
----
Forward
-----
pawn Код:
forward Payhim(playerid);
forward IsASweeper(carid);
-----
The public function;
-----
pawn Код:
public Payhim(playerid)
{
if(PlayerIsSweeping[playerid] == 1)
{
new giveplayer[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "** %s (%d) is not a streetcleaner anymore!", giveplayer,playerid);
PlayerIsSweeping[playerid] = 0;
SendClientMessage(playerid, COLOR_RED, "You earned $400 for cleaning the streets!");
SafeGivePlayerMoney(playerid,400);
SendClientMessageToAll(COLOR_BLUE, string);
}
return 1;
}
What does it do?
* Pay's the player after 2 minutes sitting into a Sweeper.
* Works on every sweeper you'll add in the map.
* Has no bugs (Maybe some warning at Compiling.
* Doesn't need any includes, just put it in your Gamemod.
How do i get some functions?
** Thanks to Raven's Roleplay for the IsASweeper Function!
It doesnt work, now what?
** Help is always here, if you got some problems, i'll set it up for you, post it here.
Regards And Enjoy, its my first Release!
Re: Streetcleaner [2 Minutes Driving] -
Kwarde - 14.04.2011
Did you make this yourself for sure?
1) It looks like the raven's roleplay / GF (idk anymore) thing.
2) You didn't include "IsASweeper" (from raven's roleplay also)
3) You didn't include colours ^^
If you made it yourself, please add those things. Then it's nicer :P
Re: Streetcleaner [2 Minutes Driving] -
Mister. M - 14.04.2011
Its almost same from that script indeed, but that one doesnt have a timer.
~~ I'll add the colors alright (:
Re: Streetcleaner [2 Minutes Driving] -
Kwarde - 14.04.2011
Then it's alot better
And I have some tips/information for you, that could be usefull.
1) [ pawn ][ /pawn ] BBcode's are special for PAWN codes.
Normal [ code ]:
Код:
public OnGameModeInit()
{
SendRconCommand("exit");
return 1;
}
PAWN [ pawn ] code:
pawn Код:
public OnGameModeInit()
{
SendRconCommand("exit");
return 1;
}
2) The IsASweeper could be better :
pawn Код:
stock IsASweeper(carid)
return GetVehicleModel(carid) = 574 ? true : false;
(that is the same as:
pawn Код:
stock IsASweeper(carid)
{
if(GetVehicleModel(carid) == 574)
return true;
else return false;
//return false; //Not sure if this is needed. -.-
}
3) Stock/Callbacks
You don't need to use forward+public for a function such as "IsASweeper". A callback (forward+public) is only needed for timers and for things that's being called. If you don't understand it, I have an example:
public OnPlayerConnect - Is being called when a player connects.
public OnGameModeInit - Is being called when the gamemode is starting loading
public OnPlayerDeath - Is being called when someone dies
Do you understand it now? For IsASweeper you do only need the "stock"
4) Code uploading
www.pastebin.com -> There you can make the whole script, so people can simply copy it, if they want that
You don't have to use it, it's just a tip.
This script is nice though :P - I didn't see such a script yet (or maybe I'm blind... But I guess I'm not)
- Kevin
Re: Streetcleaner [2 Minutes Driving] -
Mister. M - 14.04.2011
Thanks but like i already posted, the IsASweeper is from the GameMod: Raven's Roleplay.
And thanks for your reaction enyway's.
Like your comment.
~~ Regards
Re: Streetcleaner [2 Minutes Driving] -
Kwarde - 14.04.2011
I know, so I'm telling that it could be better done
Raven's roleplay uses actually alot waste functions etc. However, this topic's not going about that. I'm stopping to be off-topic now.
I like by the way the "Hello world" text :P (I don't know why, I like it. Maybe cuz it was the first text I've ever echo'd/printed at any script language I do.)
- Kevin
This forum requires that you wait 120 seconds between posts. Please try again in 3 seconds.
Re: Streetcleaner [2 Minutes Driving] -
Mister. M - 14.04.2011
Well,
The idea is from Unlimited-RPG, they have a shit load of customs, like that Road Trucker, they have it all changed, never see'n anything like it.
Its very customized.
Enjoy this script, its almost the same!
Код:
OffTopic ~~
++ Im searching for a good scripter/coder, to create a new server with (RP), if you are one?
Please contact me at Mikey_vd_worp@live.nl
Multiply good guys, so we can all have something to do, like a Housecar System etc.
Hope you're intressted, contact me then.
Re: Streetcleaner [2 Minutes Driving] -
Mister. M - 15.04.2011
No more reactions, haha, unthankfull people arround here.
Re: Streetcleaner [2 Minutes Driving] -
Kwarde - 15.04.2011
It's not the worst for you:
http://forum.sa-mp.com/forumdisplay....t&pp=20&page=1
Some people didn't ever get a response.
Re: Streetcleaner [2 Minutes Driving] -
Mister. M - 15.04.2011
Wow ahahahaha