Command needed - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command needed (
/showthread.php?tid=87716)
Command needed -
[Sk]Noob - 21.07.2009
I need a command for RP script for the taxi job...
When i do /counter on it will take 2 dollars every 5 seconds from the guy who siting in my taxi
and when i do /counter off it'll stop.
Thx for the helpers...
Re: Command needed -
[Sk]Noob - 22.07.2009
please help with this...
Re: Command needed -
M4S7ERMIND - 22.07.2009
Havent tested it, but should work
pawn Код:
new PayTime[MAX_PLAYERS];
new InTaxi[MAX_PLAYERS];
public OnPlayerExitVehicle(playerid, vehicleid) {
if(InTaxi[playerid] == 1) KillTimer(PayTime[playerid]);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[]) {
if(strcmp(cmdtext,"/counter",true) == 0) {
new tmp[256], idx; tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
new taxi = GetPlayerVehicleID(playerid);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && IsPlayerInVehicle(i, taxi) && i != playerid) {
PayTime[i] = SetTimerEx("Pay", 5000, 0, "ii", playerid, i);
InTaxi[i] = 1;
}
}
}
else if(strcmp(tmp, "off", true) == 0) {
new taxi = GetPlayerVehicleID(playerid);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && IsPlayerInVehicle(i, taxi) && i != playerid) {
KillTimer(PayTime[i]);
InTaxi[i] = 0;
}
}
}
return 1;
}
return 0;
}
forward Pay(playerid, passenger);
public Pay(playerid, passenger) {
if(GetPlayerMoney(passenger) >= 2) {
GivePlayerMoney(passenger, -2);
GivePlayerMoney(playerid, 2);
PayTime[passenger] = SetTimerEx("Pay", 5000, 0, "ii", playerid, passenger);
}else{
RemovePlayerFromVehicle(passenger);
SendClientMessage(playerid, WHITE, "You have been kicked from taxi..");
}
}
You should also add InTaxi[playerid] = 0; OnPlayerConnect
Have fun
Re: Command needed -
[Sk]Noob - 22.07.2009
I got those warnings..
Код:
C:\Documents and Settings\Yarik\Desktop\CD-Disabler 1.2\one of the best edits\gamemodes\crp.pwn(2111) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Yarik\Desktop\CD-Disabler 1.2\one of the best edits\gamemodes\crp.pwn(2111) : warning 219: local variable "idx" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Warnings.
Line 2111
Код:
new tmp[256], idx; tmp = strtok(cmdtext, idx);
Re: Command needed -
M4S7ERMIND - 22.07.2009
delete this
Have fun
Re: Command needed -
[Sk]Noob - 22.07.2009
Okay thats nice -.-
Код:
C:\Documents and Settings\Yarik\Desktop\CD-Disabler 1.2\one of the best edits\gamemodes\crp.pwn(2238) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Yarik\Desktop\CD-Disabler 1.2\one of the best edits\gamemodes\crp.pwn(2238) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Documents and Settings\Yarik\Desktop\CD-Disabler 1.2\one of the best edits\gamemodes\crp.pwn(2238) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Warnings.
Re: Command needed -
Mowgli - 22.07.2009
deleted wrong one?
Re: Command needed -
[Sk]Noob - 22.07.2009
Okay now i entered the server after i fixed the warnings and errors ...
my friend entered the car i did /counter and nothing happend -.-
i didnt get any cash and he didnt get any -2 dollars...........
Re: Command needed -
[Sk]Noob - 22.07.2009
Any one else can help with it