Originally Posted by xenowort
lo de la vida postea el codigo,Asi vemos que pusistes y te lo podes arreglar.
lo del menu de teleports fede hiso un tuto de teleports menu,que ahi dice como poner para que te teletransporte con auto y esa misma funcion la usas para la 3 cosa que pedistes. |
if (strcmp("/vida",cmdtext,true)==0) { SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid,100.0); if(GetPlayerMoney(playerid) < 85) // cambia monto por la cantidad que le quieras quitar { SendClientMessage(playerid, rojo, "ЎNo tienes suficiente dinero para pagar eso!"); // esto es solo un mensaje como ejemplo, puede sustituirlo por cualquier codigo } return 1; }
if (strcmp("/vida",cmdtext,true)==0) { if(GetPlayerMoney(playerid) < 85) // cambia monto por la cantidad que le quieras quitar { SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid,100.0); } else { SendClientMessage(playerid, rojo, "ЎNo tienes suficiente dinero para pagar eso!"); // esto es solo un mensaje como ejemplo, puede sustituirlo por cualquier codigo } return 1; }
Originally Posted by xenowort
Код:
if (strcmp("/vida",cmdtext,true)==0) { if(GetPlayerMoney(playerid) < 85) // cambia monto por la cantidad que le quieras quitar { SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid,100.0); } else { SendClientMessage(playerid, rojo, "ЎNo tienes suficiente dinero para pagar eso!"); // esto es solo un mensaje como ejemplo, puede sustituirlo por cualquier codigo } return 1; } |
if(strcmp("/teleport", cmdtext, true) == 0){
if(IsPlayerInAnyVehicle(playerid)){
SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
SetVehicleZAngle(GetPlayerVehicleID(playerid), A);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), Interior);
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), VirtualWorld);
}
else{
SetPlayerPos(playerid, X, Y, Z);
SetPlayerFacingAngle(playerid, A);
SetPlayerInterior(playerid, Interior);
SetCameraBehindPlayer(playerid);
SetPlayerVirtualWorld(playerid, VirtualWorld);
}
}
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
new playermoney;
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new cmd[256];
new giveplayerid, moneys, idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/givecash", true) == 0) {
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
return 1;
}
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
return 1;
}
moneys = strval(tmp);
//printf("givecash_command: %d %d",giveplayerid,moneys);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys) {
GivePlayerMoney(playerid, (0 - moneys));
GivePlayerMoney(giveplayerid, moneys);
format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
}
else {
SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
}
}
else {
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
return 0;
}
if(strcmp("/vida", cmdtext, true) == 0){
new pMoney = GetPlayerMoney(playerid);
if(pMoney < 75)return SendClientMessage(playerid, 0xAA3333AA, "Debes tener 75 pesos para poder utilizar este comando");
SetPlayerHealth(playerid, 100.0);
SetPlayerArmor(playerid, 100.0);
GivePlayerMoney(playerid, -75);
return SendClientMessage(playerid, 0xFFFF00AA, "Has sido curado!");
}
Originally Posted by the_chaoz
1є te dejo un ejemplo de teleport, solo copia el codigo y pegalo donde corresponde (sin el comando)
pawn Код:
3є codigo de lvdm pawn Код:
pawn Код:
|
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
new playermoney;
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new cmd[256];
new giveplayerid, moneys, idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/givecash", true) == 0) {
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
return 1;
}
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
return 1;
}
moneys = strval(tmp);
//printf("givecash_command: %d %d",giveplayerid,moneys);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys) {
GivePlayerMoney(giveplayerid, moneys);
format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
}
else {
SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
}
}
else {
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
return 0;
}
public OnPlayerSelectedMenuRow(playerid, row) { new Menu:current; current = GetPlayerMenu(playerid); if(current == Teles) { switch(row) { case 0: // LV { SetPlayerPos(playerid,2025.8523,1545.7911,10.8203); HideMenuForPlayer(Teles, playerid); TogglePlayerControllable(playerid, 1); }