Vice City Multiplayer
VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: RookieCookie on August 21, 2014, 05:25:57 am
-
I need help on the following things :
Q : I want to make custom health values for pickups,for example,a life icon gives 50 HP.
Q : My commands won't work.I typed the commands but nothing happened!
Q : I want to restrict other teams from picking up specific icons.For example,team Tommy can't pick up the armor,only team Diaz can.
I need real quick help on this,please include the script codes (like SetPlayerHealth) in your comments.
Thanks.
-
I really need quick help,my script's deadline is coming soon.
-
1.
public OnPickedUp(pickupid, playerid)//a function that is called once player picks something up
{
if(pickupid == ID)//replace the "ID" with the id of a pickup you want to act
{
new Float:ph;//creating a variable to store player health in
GetPlayerHealth(playerid, ph);//by this we get hp of a player who picked up the pickup and store it in "ph"
SetPlayerHealth(playerid, ph + 50);//by ph + 50 we increase player's hp by 50 points
}
return 1;
}
2. Post here the code including your command
3. Make a check to make sure that Diaz team picked the pickup up. :D
public OnPickedUp(pickupid, playerid)
{
if(GetPlayerTeam(playerid) == Diaz)//replace "Diaz" with your ID you gave to Diaz team.
{
//declare here what you want the pickup to do to diaz team players once one of them picks it up.
}
}
-
My commands :
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext," engineoff ", true)==0)
{
new vehicleid = GetPlayerVehicleID(playerid);
KillVehicleEngine(vehicleid); // Engine off
SendClientMessage(playerid,COLOR_WHITE,"Car engine turned off,re-enter the vehicle to restart it.");
return 1;
}
if (strcmp(cmdtext," lightson ",true)==0)
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleLights(vehicleid,1); // Lights on
SendClientMessage(playerid,COLOR_WHITE,"Car headlights turned on");
return 1;
}
else if (strcmp(cmdtext," lightsoff ",true)==0)
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleLights(vehicleid,0); // Lights off
SendClientMessage(playerid,COLOR_WHITE,"Car headlights turned off");
return 1;
}
if (strcmp(cmdtext," wakeup ",true)==0)
{
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid,COLOR_WHITE,"You are now awake!");
return 1;
}
return 1;
}
-
What code should I put if I don't want the pickup to work for team Tommy?
-
What code should I put if I don't want the pickup to work for team Tommy?
if(GetPlayerTeam(playerid) != Tommy)//Your Tommy team ID instead of "Tommy"
-
My commands :
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext," engineoff ", true)==0)
{
new vehicleid = GetPlayerVehicleID(playerid);
KillVehicleEngine(vehicleid); // Engine off
SendClientMessage(playerid,COLOR_WHITE,"Car engine turned off,re-enter the vehicle to restart it.");
return 1;
}
if (strcmp(cmdtext," lightson ",true)==0)
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleLights(vehicleid,1); // Lights on
SendClientMessage(playerid,COLOR_WHITE,"Car headlights turned on");
return 1;
}
else if (strcmp(cmdtext," lightsoff ",true)==0)
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleLights(vehicleid,0); // Lights off
SendClientMessage(playerid,COLOR_WHITE,"Car headlights turned off");
return 1;
}
if (strcmp(cmdtext," wakeup ",true)==0)
{
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid,COLOR_WHITE,"You are now awake!");
return 1;
}
return 1;
}
Are you sure all the commands don't work?
-
I typed commands like /c wakeup and nothing happened.
-
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext,"engineoff", true)==0)
{
new vehicleid = GetPlayerVehicleID(playerid);
KillVehicleEngine(vehicleid); // Engine off
SendClientMessage(playerid,0xFFFFFFFF,"Car engine turned off,re-enter the vehicle to restart it.");
return 1;
}
if (strcmp(cmdtext,"lightson",true)==0)
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleLights(vehicleid,1); // Lights on
SendClientMessage(playerid,0xFFFFFFFF,"Car headlights turned on");
return 1;
}
if (strcmp(cmdtext,"lightsoff",true)==0)
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleLights(vehicleid,0); // Lights off
SendClientMessage(playerid,0xFFFFFFFF,"Car headlights turned off");
return 1;
}
if (strcmp(cmdtext,"wakeup",true)==0)
{
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid,0xFFFFFFFF,"You are now awake!");
return 1;
}
return 1;
}
Guess what was the problem? You typed " " (space) before and after each word in commands, like " lightson " instead of "lightson". Also, I'd recommend that you use more checks, and, tbh, I don't find /c wakeup useful.
-
not work!!!
-
not work!!!
?:D
He requested help, not posted his work.
-
not work!!!
Actually,it does.
After using them my commands worked perfectly.
-
error 076: syntax error in the expression, or invalid function call
[pawn] KillTimer(testtimer);[/pawn]