/putnitro help -
MWF2 - 16.12.2010
I'm trying to make a /putnitro command to be able to put nitro on vehicles but it no working can someone help me out!
pawn Код:
if(strcmp(cmd, "/putnitro", true) == 0)
{
new tempid = GetPlayerVehicleID(playerid);
if(IsSpawned[playerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
return 1;
}
if(InDerby[playerid] == 1) {
SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
return 1;
}
if(gTeam[playerid] != TEAM_MECHANIC) {
SendClientMessage(playerid,COLOR_ERROR,"You are not a Car Mechanic");
return 1;
}
if(fixedcarrecent[playerid] >=1) {
SendClientMessage(playerid,COLOR_ERROR,"Command used recently. Please wait");
return 1;
}
if(!IsValidNosVehicle(tempid)) {
SendClientMessage(playerid,COLOR_ERROR,"You cannot add nitro to this vehicle!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /putnitro (id)");
return 1;
}
giveplayerid = strval(tmp);
if(!IsNumeric(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /putnitro (id) ID Must be a number");
return 1;
}
if(!IsPlayerConnected(giveplayerid)) {
format(szstring, sizeof(szstring), "ID (%d) is not an active player", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, szstring);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 5) {
format(szstring, sizeof(szstring), "(%d) Is not close enough. You cannot add nitro to that players vehicle",giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, szstring);
return 1;
}
GetPlayerName(playerid,mname, 24);
GetPlayerName(giveplayerid, pname, 24);
if(!IsPlayerInAnyVehicle(giveplayerid)) {
format(szstring, sizeof(szstring), "%s(%d) is not in any vehicle",pname,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, szstring);
return 1;
}
if(IsValidNosVehicle(tempid)) {
AddVehicleComponent(tempid, 1009);
new mrand = random(10000);
oscore = GetPlayerScore(playerid);
GivePlayerMoney(giveplayerid,-mrand);
GivePlayerMoney(playerid,mrand);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_NITRO ADDED_|");
format(szstring, sizeof(szstring), "Mechanic %s(%d) has added nitro to your vehicle for $%d",mname,playerid,mrand);
SendClientMessage(giveplayerid,COLOR_DODGERBLUE, szstring);
SendClientMessage(playerid, 0xA9A9A9AA, "|_NITRO ADDED_|");
format(szstring, sizeof(szstring), "You have added nitro to %s(%d)s vehicle. You earned $%d", pname,giveplayerid,mrand);
SendClientMessage(playerid,COLOR_DODGERBLUE, szstring);
SetPlayerScore(playerid, oscore +1);
return 1;
}
else {
format(szstring, sizeof(szstring), "%s(%d) is not the driver of the vehicle",pname,giveplayerid);
SendClientMessage(giveplayerid,COLOR_DODGERBLUE, szstring);
}
return 1;
}
Re: /putnitro help -
WillyP - 16.12.2010
What doesn't work?
Re: /putnitro help -
The_Gangstas - 16.12.2010
?
pawn Код:
if(strcmp(cmd, "/putnitro", true) == 0)
{
if(IsSpawned[playerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
return 1;
}
if(InDerby[playerid] == 1) {
SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
return 1;
}
if(gTeam[playerid] != TEAM_MECHANIC) {
SendClientMessage(playerid,COLOR_ERROR,"You are not a Car Mechanic");
return 1;
}
if(fixedcarrecent[playerid] >=1) {
SendClientMessage(playerid,COLOR_ERROR,"Command used recently. Please wait");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /putnitro (id)");
return 1;
}
giveplayerid = strval(tmp);
if(!IsNumeric(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /putnitro (id) ID Must be a number");
return 1;
}
if(!IsPlayerConnected(giveplayerid)) {
format(szstring, sizeof(szstring), "ID (%d) is not an active player", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, szstring);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 5) {
format(szstring, sizeof(szstring), "(%d) Is not close enough. You cannot add nitro to that players vehicle",giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, szstring);
return 1;
}
GetPlayerName(playerid,mname, 24);
GetPlayerName(giveplayerid, pname, 24);
if(!IsPlayerInAnyVehicle(giveplayerid)) {
format(szstring, sizeof(szstring), "%s(%d) is not in any vehicle",pname,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, szstring);
return 1;
}
new tempid = GetPlayerVehicleID(giveplayerid);
if(!IsValidNosVehicle(tempid)) {
SendClientMessage(playerid,COLOR_ERROR,"You cannot add nitro to this vehicle!");
return 1;
}
if(IsValidNosVehicle(tempid)) {
AddVehicleComponent(tempid, 1009);
new mrand = random(10000);
oscore = GetPlayerScore(playerid);
GivePlayerMoney(giveplayerid,-mrand);
GivePlayerMoney(playerid,mrand);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_NITRO ADDED_|");
format(szstring, sizeof(szstring), "Mechanic %s(%d) has added nitro to your vehicle for $%d",mname,playerid,mrand);
SendClientMessage(giveplayerid,COLOR_DODGERBLUE, szstring);
SendClientMessage(playerid, 0xA9A9A9AA, "|_NITRO ADDED_|");
format(szstring, sizeof(szstring), "You have added nitro to %s(%d)s vehicle. You earned $%d", pname,giveplayerid,mrand);
SendClientMessage(playerid,COLOR_DODGERBLUE, szstring);
SetPlayerScore(playerid, oscore +1);
return 1;
}
else {
format(szstring, sizeof(szstring), "%s(%d) is not the driver of the vehicle",pname,giveplayerid);
SendClientMessage(giveplayerid,COLOR_DODGERBLUE, szstring);
}
return 1;
}
Re: /putnitro help -
MWF2 - 16.12.2010
Lol it doesn't actually put the nitro on the players vehicle :/
Re: /putnitro help -
MWF2 - 16.12.2010
Quote:
Originally Posted by MWF2
Lol it doesn't actually put the nitro on the players vehicle :/
|
EDIT: I'll try the code gangsta posted.
Re: /putnitro help -
The_Gangstas - 16.12.2010
i moved the new tempid to after getting the other player's id and changed it to get the other players vehicleid. you were giving yourself nitro.
Re: /putnitro help -
[XA]PuNi$HeR_ - 17.12.2010
lol btw m8 that dosent add the nos to the car
Re: /putnitro help -
MWF2 - 17.12.2010
Quote:
Originally Posted by [XA]PuNi$HeR_
lol btw m8 that dosent add the nos to the car
|
I tested it, it worked fine
Re: /putnitro help -
Fool - 17.12.2010
Quote:
Originally Posted by [FU]Victious
What doesn't work?
|
you always say that, read the topic for once the posts.
Re: /putnitro help -
WillyP - 17.12.2010
Quote:
Originally Posted by Porsche911
read the topic for once the posts.
|
lrn2speakenglish
kthx