ACMD:vehicle(playerid, params[])
{
if (pInfo[playerid][Adminlevel] < 2) return 0;
new car;
if(sscanf(params, "ud", ID, car)) return SCM(playerid, orange, "Give a player a vehicle: /vehicle <ID> <400 - 611>");
if(ID == IPI) return SCM(playerid, red, "*Player is not connected!");
new Float: x, Float: y, Float: z, Float: a;
GetPlayerPos(ID, x, y, z);
GetPlayerFacingAngle(ID, a);
new rd1 = random(20);
new rd2 = random(20);
format(ustr, sizeof(ustr), "*You have given %s vehicle ID %d", GetName(ID), car);
SCM(playerid, Lblue, ustr);
format(ustr, sizeof(ustr), "%s %s has given you vehicle ID %d", AdminLevelName(playerid), GetName(playerid), car);
SCM(ID, red, ustr);
new veh = CreateVehicle(car, x, y, z, a, rd1, rd2, -1);
PutPlayerInVehicle(ID, veh, 0);
return 1;
}
CMD:givemoney(playerid, params[])
{
if (pInfo[playerid][Adminlevel] < 2)return 0;
new Amount;
if(sscanf(params,"u",ID, Amount)) return SCM(playerid, orange, "Give money to a player: /givemoney <ID> <Amount>");
GivePlayerMoney(ID, Amount);
GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
format(ustr, sizeof(ustr), "%s %s has given you $%s", AdminLevelName(playerid),pName, Amount);
SCM(ID, red, ustr);
return 1;
}
CMD:givemoney(playerid, params[])
{
if (pInfo[playerid][Adminlevel] < 2)return 0;
new Amount;
if(sscanf(params,"u",ID, Amount)) return SCM(playerid, orange, "Give money to a player: /givemoney <ID> <Amount>");
GivePlayerMoney(ID, Amount);
GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
format(ustr, sizeof(ustr), "%s %s has given you $%s", AdminLevelName(playerid),pName, Amount);
SCM(ID, red, ustr);
return 1;
}
sscanf(params,"ud",ID, Amount)
new ID, Minutes, Reason[64];
sscanf(params, "uds[64]", ID, Minutes, Reason);
new Float:X, Float:Y, Float:Z;
sscanf(params, "fff", X, Y, Z);
I don't know scripting i was learning something about the scripts with base to start to me scripting for my self and i can make own gamemode when i finish learn to scripts i start a server becouse now iam study plus two student this year i have to learn perfectly , he, |
Here's the solution to your second problem: You are using sscanf wrong. the second parameter of the sscanf-function are the format-specifiers. If you want to get 2 params after the command, you should enter 2 specifiers. "d" for integers, "s[size]" for strings, "f" for floats and "u" for playerids". You want 2 params so you should add an extra "d" after the "u": |
CMD:refund(playerid, params[])
{
new ID, Type[12], Param3;
sscanf(params, "us[12]d", ID, Type, Param3);
if(!IsPlayerConnected(ID)) return SCM(playerid, -1, "Player not connected");
if(strcmp(Type, "vehicle", true) == 0)
{
if(Param3 < 400 || Param3 > 611) return SCM(playerid, -1, "Use: /refund vehicle [400-611]");
new Float: x, Float: y, Float: z, Float: a;
GetPlayerPos(ID, x, y, z);
GetPlayerFacingAngle(ID, a);
format(ustr, sizeof(ustr), "*You have given %s vehicle ID %d", GetName(ID), car);
SCM(playerid, Lblue, ustr);
format(ustr, sizeof(ustr), "%s %s has given you vehicle ID %d", AdminLevelName(playerid), GetName(playerid), car);
SCM(ID, red, ustr);
new veh = CreateVehicle(Param3, x, y, z, a, random(20), random(20), -1);
PutPlayerInVehicle(ID, veh, 0);
}
else if(strcmp(Type, "money", true) == 0)
{
if (pInfo[playerid][Adminlevel] < 2) return 0;
GivePlayerMoney(ID, Param3);
GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
format(ustr, sizeof(ustr), "%s %s has given you $%d", AdminLevelName(playerid),pName, Param3);
SCM(ID, red, ustr);
}
else
{
SCM(playerid, -1, "Use: /refund [id] [vehicle/money] [param]");
}
return 1;
}