Vice City Multiplayer
VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: Aqeel on January 27, 2012, 04:52:35 pm
-
Hello all.
i have just started a scripting
so need somw help
i Want to add TIMER and FREEZE for commands !heal and for all teleport commands like !fight etc
i m adding a command here so u all see and change it
[pawn]
-------GOTO FIGHT AREA--------
else if ( strcmp( cmd, "!fight", true ) == 0 )
{
SetPlayerPos(playerid,-974.17083,-839.76446,13.16437);
ResetPlayerWeapons(playerid),
SetPlayerWeapon(playerid, 20, 99999 );
format(szMsg, 128, "%s gone to ArenaSpaz.",gPlayers[playerid]);
SendClientMessageToAll( BLUE, szMsg );
return 1;
}
-------HEAL--------
{
tmp = strtok(cmdtext, idx);
SetPlayerHealth(playerid,100);
SendClientMessage(playerid,0xAAAAAA,"Congrats you have 100% healed");
return 1;
}
[/pawn]
-
hmm
}
else if ( strcmp( cmd, "!Heal", true ) == 0 )
{
new Float:Health; GetPlayerHealth( playerid, Health );
if ( Health >= 100 ) SendClientMessage( playerid, RED, "Error: You have 100" );
else {
SetTimer("TimeHealth",5000,0);
SendClientMessage(playerid,ORANGE,"Wait 5 Secs..");
}
return 1;
// Test
public TimeHealth(playerid)
{
SetPlayerHealth(playerid,100);
SendClientMessage(playerid,ORANGE,"You Have Healed ");
}
Work???
-
else if ( strcmp( cmd, "!Heal", true ) == 0 )
{
new Float:Health; GetPlayerHealth( playerid, Health );
if ( Health >= 100 ) SendClientMessage( playerid, RED, "Error: You have 100" );
else {
SetTimer("TimeHealth",5000,1);
SendClientMessage(playerid,ORANGE,"Wait 5 Secs..");
}
return 1;
}
// Test
public TimeHealth(playerid)
{
SetPlayerHealth(playerid,100);
SendClientMessage(playerid,ORANGE,"You Have Healed ");
}
Yessss
Command repaired By Me
-
YOU CAN'T SET A TIMER TO A PERSON IN PAWN!!!!!!
-
ROFLMAO >:(
Yessss
Command repaired By Me
this comand have 0 errors.
-
Okay then. Try running it, see how it doesn't work.
-
ROFLMAO >:(
Yessss
Command repaired By Me
this comand have 0 errors.
It's not about whether there is any errors in the script. But whether the script will work in-game. In this case, IT WON'T WORK!!!
-
change time
SetTimer("TimeHealth",5000,0); // no repeat heal
-
Man Funtion repaired By Me
-
change time
SetTimer("TimeHealth",5000,0); // no repeat heal
Should be SetTimer( "TimeHealth", 5000, 1 );
-
change time
SetTimer("TimeHealth",5000,0); // no repeat heal
Setting it to '0' will only make it INFINITY!!.. But I still think you shouldn't add a timer. If you still insist, try Squirrel (http://vcmp.liberty-unleashed.co.uk/forum/index.php).
-
Well i have made a timer hea cmd but it wored for me fine with the timer also when i tried testing uit on 2 players the 1st one did heal then i did but i got my heal on my 3 secs whie the other got on his secs then it worked for me :-\
-
Nice !
-
Well i have made a timer hea cmd but it wored for me fine with the timer also when i tried testing uit on 2 players the 1st one did heal then i did but i got my heal on my 3 secs whie the other got on his secs then it worked for me :-\
The SetTimer function doesn't have an arg.. as an argument. So this means that the timer will run the function but it will ignore all arguments included in the function.
For example, the function is HealPlayer( plr ). The timer will ignore the plr and run everything else.
What I'm trying to say is, your timer won't work because you can't set it to a specific person.
And about your 3 seconds advantage. During the 5 seconds when a the timer is running the script, when another player types /c heal, the player will be automaticly be included in the timer. Thus having an advantage. Lets say 1 player typed /c heal. Then another person typed /c heal when the timer left 1/2 seconds left. That's an unfair advantage.
-
This won't work
You cant pass variables thru SetTimer