Need 2 script codes!
#1

Guys I need 2 script code. I want a /pay [playerid] [amount] script code. The second script code I want is: I have 3 StaticVehicles with private use and I want to make the vehicles save on they last position they are, and respawn in the last place I leave the vehicles! Please help!
Reply
#2

Well, the simplest way is to download a gamemode, find its /pay code, and learn it. That's the simplest way if what you need is the -code-.

Anyway, for the vehicle, just get its position when you logged, and save it to a file. When you logged back in, spawn it to the last position!
Reply
#3

Yea, although the search button might be more usful.
Reply
#4

This is an example of a /pay command, you could easily change this to your preferences. (Don't critize the code it's coded on a Macintosh which is pain!)
pawn Код:
COMMAND:pay(playerid, params[])
{
    new
        user,
        string[128];
    if(sscanf(params, "ud ", user, amount)) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> That's not the way, try: /pay (player) (amount)");
    if(ConnectedStatus[user] != 3) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> That player is not currently logged in!"); // Should be changed.
    if(GetDistanceBetweenPlayers(playerid, user) > 3.0) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> You are too far away!");
    if(amount < 1 || amount > 100000) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> The amount has to between $1 and $100.000.");
    if(player[playerid][money] < amount) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> You don't have enough money to do that!");
    // Everything below this should be changed.
    format(string, sizeof(string), "{purple}** %s hands %s an amount of cash.", RemoverUnderScore(playerid), RemoveUnderScore(user));
    SendClientMessage(playerid, COLOR_WHITE, string);
    player[user][money] = player[user][money]+amount;
    player[playerid][money] = player[payerid][money]-amount;
    SetPlayerMoney(playerid, player[payerid][money]);
    SetPlayerMoney(user, player[user][money]);
    return 1;
}
Reply
#5

Quote:
Originally Posted by _rAped
Посмотреть сообщение
This is an example of a /pay command, you could easily change this to your preferences. (Don't critize the code it's coded on a Macintosh which is pain!)
pawn Код:
COMMAND:pay(playerid, params[])
{
    new
        user,
        string[128];
    if(sscanf(params, "ud ", user, amount)) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> That's not the way, try: /pay (player) (amount)");
    if(ConnectedStatus[user] != 3) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> That player is not currently logged in!"); // Should be changed.
    if(GetDistanceBetweenPlayers(playerid, user) > 3.0) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> You are too far away!");
    if(amount < 1 || amount > 100000) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> The amount has to between $1 and $100.000.");
    if(player[playerid][money] < amount) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> You don't have enough money to do that!");
    // Everything below this should be changed.
    format(string, sizeof(string), "{purple}** %s hands %s an amount of cash.", RemoverUnderScore(playerid), RemoveUnderScore(user));
    SendClientMessage(playerid, COLOR_WHITE, string);
    player[user][money] = player[user][money]+amount;
    player[playerid][money] = player[payerid][money]-amount;
    SetPlayerMoney(playerid, player[payerid][money]);
    SetPlayerMoney(user, player[user][money]);
    return 1;
}
i get this error :/

symbol is never used: "pay"
Reply
#6

Quote:
Originally Posted by NitoPSG
Посмотреть сообщение
i get this error :/

symbol is never used: "pay"
please any help
Reply
#7

Try this:
Код:
if(strcmp(cmd, "/pay", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pay [playerid/PartOfName] [amount]");
				return 1;
			}
			//giveplayerid = strval(tmp);
	        giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pay [playerid/PartOfName] [amount]");
				return 1;
			}
			moneys = strval(tmp);
			if(moneys < 1 || moneys > 100000)
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "Dont go below 1, or above 100000 at once.");
			    return 1;
			}
			if (IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
			        if(PlayerInfo[giveplayerid][pLocal] == 106)
					{
						SendClientMessage(playerid, COLOR_GRAD1, "Command not allowed in this location");
						return 1;
					}
					if (ProxDetectorS(5.0, playerid, giveplayerid))
					{
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						playermoney = GetPlayerMoney(playerid);
						if (moneys > 0 && playermoney >= moneys)
						{
						    ConsumingMoney[giveplayerid] = 1;
							GivePlayerMoney(playerid, (0 - moneys));
							GivePlayerMoney(giveplayerid, moneys);
							format(string, sizeof(string), "   You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							SendClientMessage(playerid, COLOR_GRAD1, string);
							format(string, sizeof(string), "   You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
							SendClientMessage(giveplayerid, COLOR_GRAD1, string);
							format(string, sizeof(string), "%s has paid $%d to %s", sendername, moneys, giveplayer);
							PayLog(string);
							if(moneys >= 1000000)
							{
								ABroadCast(COLOR_YELLOW,string,1);
							}
							PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
							format(string, sizeof(string), "* %s takes out some cash, and hands it to %s.", sendername ,giveplayer);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
						else
						{
							SendClientMessage(playerid, COLOR_GRAD1, "   Invalid transaction amount.");
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD1, "   Your too far away.");
					}
				}//invalid id
			}
			else
			{
				format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Reply
#8

Or upload zcmd aight ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)